How to publish messages with GeniusesOfSymfony/WebSocketBundle?

Viewed 339

I used this plugin GeniusesOfSymfony/WebSocketBundle to integrate websockets in my application.

However through the documentation I didn't find how to push data into the channel once we've subscribed to it, from outide the "socket/connect" event:

webSocket.on("socket/connect", function(session){
      session.subscribe("acme/channel", function(uri, payload){

          console.log("Received message", payload.msg);


   session.publish("acme/channel", "This is a message!");
});

How can I use something like session.publish from outise the "socket/connect" callback function?

Note that I used the "default" Topic Handler.

1 Answers
Related