-
-
Notifications
You must be signed in to change notification settings - Fork 250
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 to implement PubSub WebSockets using Elysia? #115
Comments
You should be able to use Pub/Sub just like Bun. const app = new Elysia()
.ws('/', {
open({ subscribe }) {
subscribe('topic')
},
message({ publish }) {
publish('topic', 'message')
}
}) |
And how would you subscribe to a certain topic using Eden Treaty for example? I think we need more docs on this. @SaltyAom |
topic subscribe is on server side |
How would the client know about the available topics? Say you are building a chat app with chat rooms. They rooms will be created by the users/clients. So there should be a way to subscribe to those on the client, and the server should receive them dynamically. Using Eden Treaty for example, how would I do this? |
It js just websockets. |
That's not how I used to do it with Socket.IO or Phoenix (Elixir). But it's Bun so I get it's different. Thanks for replying @kravetsone! |
On the Bun documentation there is a section for Pub/Sub Websockets, but Elysia doesn't.
The text was updated successfully, but these errors were encountered: