0

I'm evaluating KendoUI upload widget to upload an excel file to the server. When the upload completes i call a controller to import the content of this excel file to a SQL Azure database.

@(Html.Kendo().Upload()
            .Name("files")             
            .Multiple(false)
            .ShowFileList(true)                
            .Messages( m => m.HeaderStatusUploaded("OK"))
            .Messages( m => m.HeaderStatusUploading("Subiendo"))
            .Messages( m => m.Select("Seleccionar hoja excel"))
            .Async(a => a
                .Save("procesoImportacion", "Upload")
                .AutoUpload(true)
            )
        )     

I would like to use SignalR to provide the process some kind of interaction.

How can i call a signalR hub instead of a controller ?

James Wiseman
  • 29,946
  • 17
  • 95
  • 158
fadonat
  • 1
  • 3

1 Answers1

0

You could call the controller, and inside the action call the signalr hub:

var hubContext = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();

hubContext.Clients.All.sendMessage("Hello");
Cristi Pufu
  • 9,002
  • 3
  • 37
  • 43
  • Thanks for you answer but, I don't want to send messages to all clients connected to the hub, just only to the one that uploaded the excel file. I would like to do something like this hubContext.Clients.Caller.sendMesage("Hello"); i think this doesn't work outside a hub. – fadonat Jul 18 '14 at 09:39
  • The Clients.Caller outside a hub doesn´t compile ... The solution could be to call the hub from the kendo uploader instead of a controller ... – fadonat Jul 18 '14 at 10:42
  • You could also identify your user by a unique id and add them to a group with that name, and you could call `hubContext.Clients.Group("uniqueUserId123").sendMessage("hello");` – Cristi Pufu Jul 18 '14 at 11:29