News for hackers. Stuff that matters.
Re:Woe be unto you for using a WebSocket by mmzeeman on Wednesday December 22, 2021 @02:17PM (#29653754)
You don’t have to design a new protocol. There is an open protocol which works nice for this use case. It can handle dropping connections, has a nice routing mechanism, it scales pretty well, has different QoS levels, pub/sub, request/response. That protocol is... MQTT v5!

Personally I’m surprised it is not used more often by web devs.

Re:Woe be unto you for using a WebSocket by mathgladiator on Wednesday December 22, 2021 @07:04PM (#29657096)
MQTT v5 is fine enough until you have to care about reliability at scale. What I have seen happen is that it turns into a slightly better TCP where you have to build your own primitives.

For example, when you SUB, you get a SUBACK if enabled. However, there is nothing like a SUBFIN (subscribe over/finished/closed) to indicate that the subscription is over or failed. In many ways, pub/sub overcommits in many ways. Now, this all depends on what does SUBACK mean? is it durable? tied to a connection?

An interesting foil is something like rsocket. RSocket has a lot of nice things, but it requires an implementation to be damn near perfect. Paradoxically, rsocket lacks the notion of a SUBACK but it has something like a SUBFIN.

A key challenge with a stream is knowing if it is working. With request-response, you can always time out. With a stream, how does one tell the difference between we broken stream and an inactive stream?

Re:Woe be unto you for using a WebSocket by thatswrong0 on Wednesday December 22, 2021 @02:26PM (#29653856)
We use this at my place of employment and it’s generally OK except for dealing with reconnects. Also pub/sub request/response was not nearly as smooth as we had hoped and eventually we reverted back to HTTP
Re:Woe be unto you for using a WebSocket by mmzeeman on Wednesday December 22, 2021 @03:02PM (#29654290)
We have build a nice support library for it. https://github.com/cotonic/cotonic. It helps that our backend is Erlang. https://github.com/zotonic/zotonic.