Open lino-levan opened 2 months ago
Specific API proposals are also welcome.
No rooms, no grouped messaging, no safety around when can send to clients or not
Room or group concept sounds a bit application specific to me. Is there any (de facto) standard way to manage these in websocket context?
Room or group concept sounds a bit application specific to me. Is there any (de facto) standard way to manage these in websocket context?
It's basically another name for the publisher/subscriber pattern, which imho is agnostic enough to be part of the possible API.
Inspiration could be taken from socket.io directly, from message brokers (redis, nats, etc.) or even using EventTarget
interface (though I'd advise against as it'd bring many limitations)
Is your feature request related to a problem? Please describe.
Originally brought up by @lowlighter on the discord.
One of the biggest libraries in the npm ecosystem is
socket.io
, for good reason.socket.io
bridged the gap between websockets and long polling when websockets weren't mature enough in browsers. Nowadays, websockets are available everywhere so a lot of the complicated abstractions thatsocket.io
relied on are no longer useful.Today, websockets are almost perfect except for a few things:
This use case is so prevalent that
Bun
decided to implement it natively (not that I necessarily approve):Describe the solution you'd like
I'd love to see something similar to
Bun
orsocket.io
built into the std that address the above usecases, both for the client and the server.Describe alternatives you've considered
We could just tell people to reimplement the logic themselves every time, but I've definitely gotten tired of that.