4 ms·
Jsonrpc over websockets is underrated tech. Simple, easy to implement, maps to programming language constructs (async functions, events, errors) which means cod
by mirekrusin 3y ago
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 https://github.com/simdjson/simdjson
- cbsmith 3y agoIt'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.
- mirekrusin 3y agoMust have been time when spec wasn't stabilized and browsers have been introducing it. Those times are long gone.
- cbsmith 3y agoI 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.
- apitman 3y agoDo you have some specific examples?
- cbsmith 3y agoOld Android handsets seem to be the big ones.
- mirekrusin 3y agoIt 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 https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
- cbsmith 3y agoThe hit rate for fallback is pretty low. It was less than 5% the last I checked.
- mirekrusin 3y agoThis 5% includes or excludes non-human traffic?
- cbsmith 3y agoIncludes.