Question

I am using xsockets server version 2.6.1.0 running on mono 3.2.4 and javascript client version 3.0.2 on browser. Client can publish notifications to server without any problems. But subscriptions are not received.

XSockets controller source:

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
    }
}

Client side:

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.
});

Any ideas how I can make this stuff work?

Was it helpful?

Solution

You can not use 2.6.1.0 with the latest javascript API. Update server to the latest (3.0.4.1) and you will be fine.

Or downgrade the javascript to a older version. Probably something like 2.9...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top