Correctly handle WebSocket send errors.
This commit is contained in:
parent
bc9975baa1
commit
dec88bd601
@ -167,7 +167,11 @@ exports = module.exports = $coroutine (args) ->
|
|||||||
return
|
return
|
||||||
jsonRpc.on 'data', (data) ->
|
jsonRpc.on 'data', (data) ->
|
||||||
if socket.readyState is socket.OPEN
|
if socket.readyState is socket.OPEN
|
||||||
socket.send JSON.stringify data
|
socket.send (JSON.stringify data), (error) ->
|
||||||
|
if error
|
||||||
|
console.error '[WARN] WebSocket send', error
|
||||||
|
connection.close()
|
||||||
|
return
|
||||||
return
|
return
|
||||||
|
|
||||||
socket.on 'error', (error) ->
|
socket.on 'error', (error) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user