I have a question in my mind about the Caller method of SignalR. In the hub method we can call a client side function like this.
Clients.Caller.addContosoChatMessageToPage(name, message);
but when i use to call it from outside the hub context it is not found or not implemented?? like this..
var context = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
context.Clients.Caller.reportProgress(recordCount,totalCount);
Can someone enlighten me in this part or is there other way to implement it.. by now i use to implement this
var context = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
context.Clients.User(CurrentUser.Usernm).reportProgress(recordCount,totalCount);
but now we are not claim based authentication so it will be a problem if the same usernm are logged..
You can configure the Telerik UI Chat component for ASP.NET MVC and a SignalR 2 service to create a Peer-to-Peer Chat application. To create the Peer-to-Peer Chat, you have to implement the SignalR Hub server and then to implement the application client: Create the new application.
Group(message. Group). addMessage("Group Message " + message. Msg); it should be message.
Outside of the hub, there obviously is no caller because the server is the one who initiates.
If you are worried about unique user names, you'll need to implement a custom IUserIdProvider
, or you need to manage connection ids per user in some other way. Then you could call
context.Clients.Client(connectionId).reportProgress();
which would be unique.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With