In onmessage, just use a BinaryXmlElementReader instead of buffer, bufferOffset and structureDecoder.
BinaryXmlElementReader handles multple binary XML objects in the same packet, and is not limited to a buffer of 10000 bytes.
Added if (LOG>3) messages for receiving data.