Handling error in connectSocket
vjocw opened this issue · 5 comments
Hello,
We are developing a dependency that uses your library and we came across a problem where a connection hangs. I dived more deeply into the problem and noticed that in the connectSocket
in json-rpc2 function does not call the callback when net.connection
errors out. Please see the below code for connectSocket
. Was this intentional? In my testing, if I put this code block under L163, everything works as expected:
conn.on('error', (error) => {
callback(error);
});
Happy to send out a Pull Request. Please let me know.
connectSocket:
https://github.com/pocesar/node-jsonrpc2/blob/master/src/client.js#L144
conn:
https://github.com/pocesar/node-jsonrpc2/blob/master/src/client.js#L162
@vincentjocodes not in the near future 😞 the refactor is going to be in Typescript