Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How subscribe an event created inside a namespace. #115

Open
Free-Devel opened this issue Jun 15, 2021 · 3 comments
Open

How subscribe an event created inside a namespace. #115

Free-Devel opened this issue Jun 15, 2021 · 3 comments

Comments

@Free-Devel
Copy link

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
Copy link
Author

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

@mojitoo
Copy link

mojitoo commented Jun 16, 2021

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
Copy link

mojitoo commented Jun 23, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants