0
我有一個SignalR應用程序。SignalR強制某個應用程序在某個組中
////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) {
...
}
這將關聯與應用程序的連接。 問題是客戶端可以更改參數並收聽app2的消息。
什麼都可以怎麼辦?(客戶端/服務器/兩),以確保有人被分配到app1
,然後停留在app1
,即它們不能聽app2
消息,即使他們想?
這很好,我只是不想一個組看到另一組消息,即使它們都是安全的 – heyNow