Some files is forgotten to be commited...
diff --git a/js/WebSocketTransport.js b/js/WebSocketTransport.js
index 49c09a4..83f53d9 100644
--- a/js/WebSocketTransport.js
+++ b/js/WebSocketTransport.js
@@ -161,7 +161,6 @@
bytes.set(hex);
self.ws.send(bytes.buffer);
- console.log('ws.onopen: ws.send() returned.');
}
this.ws.onerror = function(ev) {
@@ -236,6 +235,13 @@
interest.scope = 1;
//var hex = encodeToHexInterest(int);
var binaryInterest = encodeToBinaryInterest(interest);
+ // If we directly use binaryInterest.buffer to feed ws.send(),
+ // WebSocket will end up sending a packet with 10000 bytes of data.
+ // That is, WebSocket will flush the entire buffer in BinaryXMLEncoder
+ // regardless of the offset of the Uint8Array. So we have to create
+ // a new Uint8Array buffer with just the right size and copy the
+ // content from binaryInterest to the new buffer.
+ // ---Wentao
var bytearray = new Uint8Array(binaryInterest.length);
bytearray.set(binaryInterest);
console.log('Send Interest registration packet.');
@@ -244,7 +250,6 @@
CSTable.push(csEntry);
this.ws.send(bytearray.buffer);
- console.log('ws.send() returned.');
return 0;
} else {