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.
diff --git a/js/WebSocketTransport.js b/js/WebSocketTransport.js
index dbda8b7..5f02803 100644
--- a/js/WebSocketTransport.js
+++ b/js/WebSocketTransport.js
@@ -5,10 +5,7 @@
 
 var WebSocketTransport = function WebSocketTransport() {    
 	this.ws = null;
-	this.maxBufferSize = 10000;  // Currently support 10000 bytes data input, consistent with BinaryXMLEncoder
-	this.buffer = new Uint8Array(this.maxBufferSize);
-	this.bufferOffset = 0;
-	this.structureDecoder = new BinaryXMLStructureDecoder();
+    this.elementReader = null;
     this.defaultGetHostAndPort = NDN.makeShuffledGetHostAndPort
         (["A.ws.ndn.ucla.edu", "B.ws.ndn.ucla.edu", "C.ws.ndn.ucla.edu", "D.ws.ndn.ucla.edu", 
           "E.ws.ndn.ucla.edu"],
@@ -24,6 +21,7 @@
 	
 	this.ws.binaryType = "arraybuffer";
 	
+    this.elementReader = new BinaryXmlElementReader(ndn);
 	var self = this;
 	this.ws.onmessage = function(ev) {
 		var result = ev.data;
@@ -37,46 +35,12 @@
 			if (LOG>3) console.log('BINARY RESPONSE IS ' + DataUtils.toHex(bytearray));
 			
 			try {
-				if (bytearray.length + self.bufferOffset >= self.buffer.byteLength) {
-					if (LOG>3) {
-						console.log("NDN.ws.onmessage: buffer overflow. Accumulate received length: " + self.bufferOffset 
-							+ ". Current packet length: " + bytearray.length + ".");
-					}
-					
-					// Purge and quit.
-					delete self.structureDecoder;
-					delete self.buffer;
-					self.structureDecoder = new BinaryXMLStructureDecoder();
-					self.buffer = new Uint8Array(self.maxBufferSize);
-					self.bufferOffset = 0;
-					return;
-				}
-				
-				/*for (var i = 0; i < bytearray.length; i++) {
-					self.buffer.push(bytearray[i]);
-				}*/
-				self.buffer.set(bytearray, self.bufferOffset);
-				self.bufferOffset += bytearray.length;
-				
-				if (!self.structureDecoder.findElementEnd(self.buffer.subarray(0, self.bufferOffset))) {
-					// Need more data to decode
-					if (LOG>3) console.log('Incomplete packet received. Length ' + bytearray.length + '. Wait for more input.');
-					return;
-				}
-				if (LOG>3) console.log('Complete packet received. Length ' + bytearray.length + '. Start decoding.');
+                // Find the end of the binary XML element and call ndn.onReceivedElement.
+                self.elementReader.onReceivedData(bytearray);
 			} catch (ex) {
 				console.log("NDN.ws.onmessage exception: " + ex);
 				return;
 			}
-			
-            ndn.onReceivedElement(self.buffer);
-
-			// Renew StrcutureDecoder and buffer after we process a full packet
-			delete self.structureDecoder;
-			delete self.buffer;
-			self.structureDecoder = new BinaryXMLStructureDecoder();
-			self.buffer = new Uint8Array(self.maxBufferSize);
-			self.bufferOffset = 0;
 		}
 	}