rpc-websockets icon indicating copy to clipboard operation
rpc-websockets copied to clipboard

How subscribe an event created inside a namespace.

Open Free-Devel opened this issue 4 years ago • 3 comments

Hi, I've created an event inside a namespace:

   [...]
   server.event(name, ns);
   [...]

Then I use this command to emit a new event:

   [...]
   server.emit(name, state);
   [...]

On the client I try to subscribe to the event in this way:

      ws.subscribe(name);
      ws.on(name, (param) => {
         console.log('new notify: ', param);
      });

But I don't get any update. I can get it just when I don't use namespace.

Thanks, Mirko

Free-Devel avatar Jun 15 '21 17:06 Free-Devel

Ok, maybe I understood. The client specifies the namespace in the server connection url, is it right? If yes is there a way for a client in a namespace to call a method in the root ('/') namespace?

Thanks, Mirko

Free-Devel avatar Jun 15 '21 21:06 Free-Devel

I also have the same issue . I'am trying to pass params to the client but it's not working . It Works great without params by the way

mojitoo avatar Jun 16 '21 18:06 mojitoo

there is a workaround i found, you could try just after emitting the event, make sure to refresh the page on client side and see if the client get notified

mojitoo avatar Jun 23 '21 09:06 mojitoo