Mike Neumegen
Mike Neumegen

Reputation: 2486

Websockets - Guaranteed full Messages?

When an "onmessage" event fires in the web socket protocol are you guaranteed the full message or is it more like a straight TCP connection where you buffer the data first and then try to extract packets.

Upvotes: 2

Views: 303

Answers (1)

dan_waterworth
dan_waterworth

Reputation: 6481

There is protocol level support for fragmented messages and streaming. But this behavior is not represented in the current Javascript API, (reference). So yes, if you receive a message, it is indeed an entire message even if it was sent as many fragments.

Upvotes: 2

Related Questions