我正在使用在单声道 3.2.4 上运行的 xsockets 服务器版本 2.6.1.0 和在浏览器上运行的 javascript 客户端版本 3.0.2。客户端可以毫无问题地向服务器发布通知。但是没有收到订阅。
XSockets 控制器源码:
public class ChatController : XSocketController
{
public void Chat(ITextArgs textArgs)
{
//this.Send(textArgs); <-- in this case calling client is notified
this.SendToAll (textArgs); // <-- calling this does not notify clients
var count = EventSubscribers.Count; // count is 0
}
}
客户端:
var conn = new XSockets.WebSocket("ws://localhost:4502/ChatController");
$("#Send").click(function(){
conn.publish('chat', { text:"test message"}); //server receives message
});
conn.subscribe('chat', function(data){
//This event is not fired when SendToAll on server side is called.
});
有什么想法可以让这些东西发挥作用吗?