node-json-socket
node-json-socket copied to clipboard
handling the exception that may occur when writing on socket
Hi Sir,
i faced an error when writing on socket with multi users.
i had checked out below you used 'https://github.com/nodejs/node/blob/master/lib/net.js'
it calls 'emit('close', ...) after already closed, so assumed your '_closed' value might be not synchronized.
Thank you Rolancia
if users didn't put error handler, the process will be terminated when exception occurs while calling _socket.write in 'sendMessage' due to the default error handler kills the process with exit code 1.
i thought the user using this library may not want to face the exception. it might happen very rarely but it will happen someday. example, i had encountered that everyday.
i think the throwing code i put can prevent that (in the beginning i put a code defining default handler but it could be bad