WebSockets guarantee order - so why are my messages scrambled?

25 points by friendlysock


evmar

From an API perspective this underlying API doesn’t make a whole lot of sense – the underlying websocket stream is ordered, so why is there an await point to receive the body of a message?

And so I double checked. It appears you can configure websocket.binaryType = 'arraybuffer' in which case onmessage is called only after a complete message arrives, which should make things serial as you’d expect. No need to build this queuing abstraction on top of it, yuck.