File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class Node {
3434 }
3535
3636 toString ( ) {
37- let s = "(" + this . identity . split ( '/' ) [ 1 ] ;
37+ let s = "(" + this . identity ;
3838 for ( let i = 0 ; i < this . labels . length ; i ++ ) {
3939 s += ":" + this . labels [ i ] ;
4040 }
Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ class WebSocketChannel {
5050 } ;
5151 this . _ws . onmessage = ( event ) => {
5252 if ( self . onmessage ) {
53- self . onmessage ( new HeapBuffer ( event . data ) ) ;
53+ var b = new HeapBuffer ( event . data ) ;
54+ self . onmessage ( b ) ;
5455 }
5556 } ;
5657 }
@@ -67,7 +68,7 @@ class WebSocketChannel {
6768 } else if ( buffer instanceof HeapBuffer ) {
6869 this . _ws . send ( buffer . _buffer ) ;
6970 } else {
70- throw new Exception ( "Don't know how to send buffer: " + buffer ) ;
71+ throw new Error ( "Don't know how to send buffer: " + buffer ) ;
7172 }
7273 }
7374
Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ import WebSocketChannel from "./ch-websocket";
2121import NodeChannel from "./ch-node" ;
2222import chunking from "./chunking" ;
2323import packstream from "./packstream" ;
24- import { alloc } from "./buf" ;
24+ import { alloc , CombinedBuffer } from "./buf" ;
2525import GraphType from '../graph-types' ;
26+ import { int , isInt } from '../integer' ;
2627
2728let Channel ;
2829if ( WebSocketChannel . available ) {
Original file line number Diff line number Diff line change @@ -72,17 +72,15 @@ try {
7272 if ( buffer instanceof buf . HeapBuffer ) {
7373 return decoder . decode ( buffer . readView ( length ) ) ;
7474 }
75- else if ( buffer instanceof buf . CombinedBuffer ) {
76- let out = streamDecodeCombinedBuffer ( buffer . _buffers , length ,
77- ( partBuffer ) => {
78- return decoder . decode ( partBuffer . readView ( partBuffer . length ) , { stream :true } ) ;
79- } ,
80- ( ) => { return decoder . decode ( ) ; }
81- ) ;
82- return out ;
83- }
8475 else {
85- throw new Error ( "Don't know how to decode strings from `" + buffer + "`." ) ;
76+ // Decoding combined buffer is complicated. For simplicity, for now,
77+ // we simply copy the combined buffer into a regular buffer and decode that.
78+ var tmpBuf = buf . alloc ( length ) ;
79+ for ( var i = 0 ; i < length ; i ++ ) {
80+ tmpBuf . writeUInt8 ( buffer . readUInt8 ( ) ) ;
81+ } ;
82+ tmpBuf . reset ( ) ;
83+ return decoder . decode ( tmpBuf . readView ( length ) ) ;
8684 }
8785 }
8886 }
You can’t perform that action at this time.
0 commit comments