I have a SignalR application.
////Server
public class ChatHub : Hub{
public override Task OnConnected()
{
string name = Context.QueryString["applicationName"].ToString();// Context.User.Identity.Name;
this.Groups.Add(Context.ConnectionId, name);
return base.OnConnected();
}
}
//// Client
$.connection.hub.url = "http://localhost:40000/signalr";
$.connection.hub.qs = 'applicationName=app1';
// Declare a proxy to reference the hub.
var chat = $.connection.chatHub;
// Create a function that the hub can call to broadcast messages.
chat.client.addMessage = function (name, message) {
...
}
This will associate a connection with an application. The problem is that the client can change the parameters and listen to messages for app2.
What all can I do (client / server /both ) to ensure that someone gets assigned to app1
and then stays on app1
, ie they can't listen to app2
messages even if they wanted to?