Skip to content

How to emit with custom event name? and broadcast? #178

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

Closed
kabaluyot opened this issue Dec 10, 2019 · 2 comments
Closed

How to emit with custom event name? and broadcast? #178

kabaluyot opened this issue Dec 10, 2019 · 2 comments
Labels

Comments

@kabaluyot
Copy link

Coming from socket.io background, its very hard to understand how this work using the "echo" example. I was able to find your library suitable for our application but the documentation makes you scratch your head especially for beginners like me. How to emit with custom event name? and broadcast?

@nhooyr nhooyr added the docs label Dec 10, 2019
@nhooyr
Copy link
Contributor

nhooyr commented Dec 10, 2019

This library is more low level than socket.io.

To emit events you write JSON to then connection with whatever structure you want and to broadcast events you need to keep track of the interested clients yourself.

I'd also recommend reading https://sookocheff.com/post/networking/how-do-websockets-work/ to understand how WebSockets work better.

@nhooyr nhooyr closed this as completed Dec 10, 2019
@nhooyr
Copy link
Contributor

nhooyr commented Dec 10, 2019

You can also follow along on #174 for a more complete example.

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

No branches or pull requests

2 participants