Skip to content

Commit

Permalink
+1
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Jan 31, 2024
1 parent e16179c commit d498c27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rest/server/server.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,19 @@ namespace $ {
chan.send_code = ()=> {}
chan.send_type = ()=> {}

chan.send_nil = ()=> sock.write( $mol_websocket_frame.make( 'pong', 0 ).asArray() )
chan.send_nil = ()=> {
if( sock.writableEnded ) return
sock.write( $mol_websocket_frame.make( 'pong', 0 ).asArray() )
}

chan.send_bin = data => {
if( sock.writableEnded ) return
sock.write( $mol_websocket_frame.make( 'bin', data.byteLength ).asArray() )
sock.write( data )
}

chan.send_text = data => {
if( sock.writableEnded ) return
const bin = $mol_charset_encode( data )
sock.write( $mol_websocket_frame.make( 'txt', bin.byteLength ).asArray() )
sock.write( bin )
Expand Down

0 comments on commit d498c27

Please sign in to comment.