问题
I am using Node.js as a proxy server and I cannot get rid of the following error. Can anyone familiar with NodeJS assist in finding a solution. Each time this happens I have to restart the .js proxy.
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (http.js:1264:15)
at CleartextStream.socketCloseListener (http.js:1315:23)
at CleartextStream.EventEmitter.emit (events.js:93:17)
at SecurePair.destroy (tls.js:938:22)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Thanks in advance for any assistance.
回答1:
This error happens sometimes, it's normal, because client/server can break connection by himself in a wrong way. You could listen for 'error' event on socket, so you can catch error and don't restart whole process.
来源:https://stackoverflow.com/questions/37052874/node-js-proxy-server-socket-hang-up