@@ -33,12 +33,12 @@ addToLibrary({
3333
3434#if SOCKET_DEBUG
3535 // If debug is enabled register simple default logging callbacks for each Event.
36- SOCKFS . on ( 'error' , ( error ) => dbg ( ' websocket: error ' + error ) ) ;
37- SOCKFS . on ( 'open' , ( fd ) => dbg ( ' websocket: open fd = ' + fd ) ) ;
38- SOCKFS . on ( 'listen' , ( fd ) => dbg ( ' websocket: listen fd = ' + fd ) ) ;
39- SOCKFS . on ( 'connection' , ( fd ) => dbg ( ' websocket: connection fd = ' + fd ) ) ;
40- SOCKFS . on ( 'message' , ( fd ) => dbg ( ' websocket: message fd = ' + fd ) ) ;
41- SOCKFS . on ( 'close' , ( fd ) => dbg ( ' websocket: close fd = ' + fd ) ) ;
36+ SOCKFS . on ( 'error' , ( error ) => dbg ( ` websocket: error ${ error } ` ) ) ;
37+ SOCKFS . on ( 'open' , ( fd ) => dbg ( ` websocket: open fd = ${ fd } ` ) ) ;
38+ SOCKFS . on ( 'listen' , ( fd ) => dbg ( ` websocket: listen fd = ${ fd } ` ) ) ;
39+ SOCKFS . on ( 'connection' , ( fd ) => dbg ( ` websocket: connection fd = ${ fd } ` ) ) ;
40+ SOCKFS . on ( 'message' , ( fd ) => dbg ( ` websocket: message fd = ${ fd } ` ) ) ;
41+ SOCKFS . on ( 'close' , ( fd ) => dbg ( ` websocket: close fd = ${ fd } ` ) ) ;
4242#endif
4343
4444 return FS . createNode ( null , '/' , { { { cDefs . S_IFDIR } } } | 511 /* 0777 */ , 0 ) ;
@@ -127,7 +127,7 @@ addToLibrary({
127127 if ( ! SOCKFS . nextname . current ) {
128128 SOCKFS . nextname . current = 0 ;
129129 }
130- return ' socket[' + ( SOCKFS . nextname . current ++ ) + ']' ;
130+ return ` socket[${ SOCKFS . nextname . current ++ } ]` ;
131131 } ,
132132 // backend-specific stream ops
133133 websocket_sock_ops : {
@@ -202,7 +202,7 @@ addToLibrary({
202202 }
203203
204204#if SOCKET_DEBUG
205- dbg ( ' websocket: connect: ' + url + ', ' + subProtocols . toString ( ) ) ;
205+ dbg ( ` websocket: connect: ${ url } , ${ subProtocols . toString ( ) } ` ) ;
206206#endif
207207 // If node we use the ws library.
208208 var WebSocketConstructor ;
@@ -222,7 +222,7 @@ addToLibrary({
222222 }
223223
224224#if SOCKET_DEBUG
225- dbg ( ' websocket: adding peer: ' + addr + ':' + port ) ;
225+ dbg ( ` websocket: adding peer: ${ addr } : ${ port } ` ) ;
226226#endif
227227
228228 var peer = {
@@ -240,7 +240,7 @@ addToLibrary({
240240 // remote end.
241241 if ( sock . type === { { { cDefs . SOCK_DGRAM } } } && typeof sock . sport != 'undefined' ) {
242242#if SOCKET_DEBUG
243- dbg ( ' websocket: queuing port message (port ' + sock . sport + ')' ) ;
243+ dbg ( ` websocket: queuing port message (port ${ sock . sport } )` ) ;
244244#endif
245245 peer . msg_send_queue . push ( new Uint8Array ( [
246246 255 , 255 , 255 , 255 ,
@@ -275,7 +275,7 @@ addToLibrary({
275275 var queued = peer . msg_send_queue . shift ( ) ;
276276 while ( queued ) {
277277#if SOCKET_DEBUG
278- dbg ( ' websocket: sending queued data (' + queued . byteLength + ' bytes): ' + [ Array . prototype . slice . call ( new Uint8Array ( queued ) ) ] ) ;
278+ dbg ( ` websocket: sending queued data (${ queued . byteLength } bytes): ${ new Uint8Array ( queued ) } ` ) ;
279279#endif
280280 peer . socket . send ( queued ) ;
281281 queued = peer . msg_send_queue . shift ( ) ;
@@ -303,7 +303,7 @@ addToLibrary({
303303 }
304304
305305#if SOCKET_DEBUG
306- dbg ( ' websocket: handle message (' + data . byteLength + ' bytes): ' + [ Array . prototype . slice . call ( data ) ] ) ;
306+ dbg ( ` websocket : handle message ( ${ data . byteLength } bytes ) : ${ data } ` ) ;
307307#endif
308308
309309 // if this is the port message, override the peer's port with it
@@ -506,7 +506,7 @@ addToLibrary({
506506 var WebSocketServer = require ( 'ws' ) . Server ;
507507 var host = sock . saddr ;
508508#if SOCKET_DEBUG
509- dbg ( ' websocket: listen: ' + host + ':' + sock . sport ) ;
509+ dbg ( ` websocket: listen: ${ host } : ${ sock . sport } ` ) ;
510510#endif
511511 sock . server = new WebSocketServer ( {
512512 host,
@@ -517,7 +517,7 @@ addToLibrary({
517517
518518 sock . server . on ( 'connection' , function ( ws ) {
519519#if SOCKET_DEBUG
520- dbg ( ' websocket: received connection from: ' + ws . _socket . remoteAddress + ':' + ws . _socket . remotePort ) ;
520+ dbg ( ` websocket: received connection from: ${ ws . _socket . remoteAddress } : ${ ws . _socket . remotePort } ` ) ;
521521#endif
522522 if ( sock . type === { { { cDefs . SOCK_STREAM } } } ) {
523523 var newsock = SOCKFS . createSocket ( sock . family , sock . type , sock . protocol ) ;
@@ -643,15 +643,15 @@ addToLibrary({
643643 }
644644 }
645645#if SOCKET_DEBUG
646- dbg ( ' websocket: queuing (' + length + ' bytes): ' + [ Array . prototype . slice . call ( new Uint8Array ( data ) ) ] ) ;
646+ dbg ( ` websocket: queuing (${ length } bytes): ${ new Uint8Array ( data ) } ` ) ;
647647#endif
648648 dest . msg_send_queue . push ( data ) ;
649649 return length ;
650650 }
651651
652652 try {
653653#if SOCKET_DEBUG
654- dbg ( ' websocket: send (' + length + ' bytes): ' + [ Array . prototype . slice . call ( new Uint8Array ( data ) ) ] ) ;
654+ dbg ( ` websocket: send (${ length } bytes): ${ new Uint8Array ( data ) } ` ) ;
655655#endif
656656 // send the actual data
657657 dest . socket . send ( data ) ;
@@ -699,14 +699,14 @@ addToLibrary({
699699 } ;
700700
701701#if SOCKET_DEBUG
702- dbg ( ' websocket: read (' + bytesRead + ' bytes): ' + [ Array . prototype . slice . call ( res . buffer ) ] ) ;
702+ dbg ( ` websocket: read (${ bytesRead } bytes): ${ res . buffer } ` ) ;
703703#endif
704704
705705 // push back any unread data for TCP connections
706706 if ( sock . type === { { { cDefs . SOCK_STREAM } } } && bytesRead < queuedLength ) {
707707 var bytesRemaining = queuedLength - bytesRead ;
708708#if SOCKET_DEBUG
709- dbg ( ' websocket: read: put back ' + bytesRemaining + ' bytes' ) ;
709+ dbg ( ` websocket: read: put back ${ bytesRemaining } bytes` ) ;
710710#endif
711711 queued . data = new Uint8Array ( queuedBuffer , queuedOffset + bytesRead , bytesRemaining ) ;
712712 sock . recv_queue . unshift ( queued ) ;
0 commit comments