hntrl
Joined 3 years ago
Joined 3 years ago
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_...
https://en.wikipedia.org/wiki/Command%E2%80%93query_separati...
Websockets are a web standard, socket.io is a userland framework
To me the sticking point is what if the "response" message never comes? There's nothing in the websocket protocol that dictates that messages need to be acknowledged. With request/response the client knows how to handle that case natively
> And the websocket browser API is nicer to work with than, say, EventSource.
What in particular would you say?
(it's not SSE in particular, but it demonstrates that you can have a long running stream like SSE)
The SSE protocol is actually just a long-running stream like I mentioned but with specific formatting for each chunk (id, event, and data fields)
as a side note, eventkit actually exports utilities to support SSE both on client and server. The reason you'd want to use eventkit in either case is because it ships with some extra transformation and observability goodies. https://hntrl.github.io/eventkit/guide/examples/http-streami...