Correctly handle WebSocket send errors.

This commit is contained in:
Julien Fontanet 2015-02-03 14:34:15 +01:00
parent bc9975baa1
commit dec88bd601

View File

@ -167,7 +167,11 @@ exports = module.exports = $coroutine (args) ->
return
jsonRpc.on 'data', (data) ->
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
socket.on 'error', (error) ->