elpheria/rpc-websockets

How subscribe an event created inside a namespace.

Free-Devel opened this issue · 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

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

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

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