4 ms·
My favorite plain text protocol is HTML server sent events, within HTTP. It's really trivial to make a server produce these -- it's just some simple newline-de
by evmar 6y ago
My favorite plain text protocol is HTML server sent events, within HTTP. It's really trivial to make a server produce these -- it's just some simple newline-delimited printfs() to the socket -- and they manifest client-side as simple event objects.
https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream https://html.spec.whatwg.org/multipage/server-sent-events.ht...
- jeffbee 6y agoDon't you have to deal with the problem of having a double newline in the field? Any time the value has a newline you have to restart with the field name, colon, and space. So it's not quite trivial to produce.
- jacques_chester 6y agoThey are simple, but it's very slow, in my experience.
- remram 6y agoSlower than websockets or WebRTC?
- jacques_chester 6y agoThe usage I've seen is to send log lines. In that case it's a lot slower than bundling stuff up into single requests/responses over HTTP.
- remram 6y agoYou mean, using server-sent events for things that are not events but data, one row at a time? Of course that'd be slow, but that's equivalent to sending one websocket frame for each row, or one file per row over HTTP multipart. Hardly talks to the speed of either protocol.
- jacques_chester 6y agoI disagree. SSE makes one design easier. If that's great, great. If not, not. But per-unit SSE is ships more slowly because it doesn't allow for easy batching.
- 1f60c 6y agoI thought server sent events were dead, or am I thinking about something else?