我使用的是运行在mono 3.2.4和浏览器上的javascript客户端版本3.0.2的xsockets服务器版本2.6.1.0。客户端可以将通知发布到服务器,而不会出现任何问题。但是没有收到订阅。
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 =新的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.
});我有什么办法让这些东西起作用吗?
发布于 2014-02-23 09:55:50
您不能在最新的javascript中使用2.6.1.0。将服务器更新到最新版本(3.0.4.1),您会没事的。
或者将javascript降级为旧版本。大概是2.9..。
https://stackoverflow.com/questions/21962819
复制相似问题