@@ -70,6 +70,7 @@ DashSightServer.create = function ({ rpc, wss, authenticate }) {
7070
7171 dss . sockets = { } ;
7272 dss . sockets . onconnection = async function ( ws , request ) {
73+ console . error ( "[DEBUG] dss.sockets.onconnection" ) ;
7374 ws . on ( "error" , console . error ) ;
7475
7576 // TODO session should establish which hostname and port
@@ -96,9 +97,9 @@ DashSightServer.create = function ({ rpc, wss, authenticate }) {
9697 return ;
9798 }
9899
99- console . log ( `DEBUG ws query:` ) ;
100+ console . log ( `[ DEBUG] ws query:` ) ;
100101 console . log ( query ) ;
101- let stream = WebSocket . createWebSocketStream ( ws ) ;
102+ let stream = WebSocket . createWebSocketStream ( ws , { encoding : null } ) ;
102103 let conn = Net . createConnection ( {
103104 host : query . hostname ,
104105 port : query . port ,
@@ -108,14 +109,29 @@ DashSightServer.create = function ({ rpc, wss, authenticate }) {
108109 } ) ;
109110 stream . pipe ( conn ) ;
110111 conn . pipe ( stream ) ;
112+ ws . on ( "open" , function ( chunk ) {
113+ console . log ( "[DEBUG] ws.on open" ) ;
114+ } ) ;
115+ ws . on ( "message" , function ( chunk ) {
116+ let hex = chunk . toString ( "hex" ) ;
117+ console . log ( "[DEBUG] ws.on data hex" , hex ) ;
118+ } ) ;
119+ conn . on ( "data" , function ( chunk ) {
120+ let hex = chunk . toString ( "hex" ) ;
121+ console . log ( "[DEBUG] conn.on data hex" , hex ) ;
122+ // ws.send(chunk);
123+ } ) ;
111124
112125 stream . once ( "error" , disconnect ) ;
113126 stream . once ( "end" , disconnect ) ;
114127 stream . once ( "close" , disconnect ) ;
115128 function disconnect ( ) {
129+ console . log ( "[DEBUG] ws stream pipe disconnected" ) ;
116130 conn . end ( ) ;
117131 conn . destroy ( ) ;
118132 }
133+
134+ console . log ( "[DEBUG] piped each end and added handlers" ) ;
119135 } ;
120136
121137 dss . router = new AsyncRouter . Router ( ) ;
0 commit comments