If I'm sending a large Blob
or ArrayBuffer
over a JavaScript WebSocket
via its send
method... does the send
method call block until the data is sent, or does it make a copy of the data to send asynchronously so the call can return immediately?
A related (unanswered) question is, from how I interpret it, whether a rapid series of sends will cause onmessage events to be delayed, as someone seems to have described happening in Mobile Safari: Apparent blocking behaviour in JavaScript websocket on mobile Safari
Based on the description of the
bufferedAmount
attribute, I have deduced thatsend
must return immediately, because otherwisebufferedAmount
would always be zero. If it is non-zero, then there must be data buffered from a prior call to send, and if send buffers data, there's no reason for it to block.From http://dev.w3.org/html5/websockets/