News for hackers. Stuff that matters.
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by mirekrusin on Monday March 18, 2024 @01:48PM (#39747570)
Jsonrpc over websockets is underrated tech. Simple, easy to implement, maps to programming language constructs (async functions, events, errors) which means code looks natural as any library/package/module usage devs are used to, can be easily decorated with type safety, easy to debug, log, optimize etc, works on current browsers and can be used for internal service to service comms, it's fast (ie. nodejs is using simdjson [0]), can be compressed if needed (rarely the need), we built several things on top of it ie. async generators (avoids head of line blocking, maps naturally to typescript/js async generators).

[0] https://github.com/simdjson/simdjson

Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by cbsmith on Monday March 18, 2024 @02:40PM (#39748224)
It's been a while since I've used websockets, but at least the last time I did, "simple" wouldn't be the word I'd have used. All kinds of annoying issues between different browsers. SSE was generally much simpler.
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by mirekrusin on Monday March 18, 2024 @02:45PM (#39748302)
Must have been time when spec wasn't stabilized and browsers have been introducing it. Those times are long gone.
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by cbsmith on Monday March 18, 2024 @02:58PM (#39748476)
I don't know about long gone. I still support a websocket solution that needs to have server-push as a fallback because of browser incompatibility issues.
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by mirekrusin on Monday March 18, 2024 @04:25PM (#39749557)
It shouldn't be a problem for about a decade [0]?

What's your hit rate for the fallback?

[0] https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by cbsmith on Monday March 18, 2024 @05:22PM (#39750199)
The hit rate for fallback is pretty low. It was less than 5% the last I checked.
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by mirekrusin on Tuesday March 19, 2024 @01:31AM (#39753215)
This 5% includes or excludes non-human traffic?
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by cbsmith on Tuesday March 19, 2024 @06:47PM (#39761101)
Includes.
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by apitman on Monday March 18, 2024 @03:44PM (#39749055)
Do you have some specific examples?
Re:WebSockets vs. Server-Sent-Events vs. Long-Polling vs. We... by cbsmith on Monday March 18, 2024 @05:22PM (#39750194)
Old Android handsets seem to be the big ones.