diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-07-16 12:32:03 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-07-16 12:32:03 -0400 |
commit | b7df60369e35df143dc26a024a1ed0b4038c1889 (patch) | |
tree | 613064c58e935cb6ad137388bf78df9a07b4b291 | |
parent | 85f90046ad23292f683bb199c6a0087a6464a2a3 (diff) |
made websocket errors log more specifically
-rw-r--r-- | socket.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -19,8 +19,8 @@ class retryws extends EventEmitter{ // a wrapper on ws that retries on failure function sockinit(){ // addr is not expected to change, so not handed as input; similarly, sock is not passed in a chain because behavior is expected to be serial (either initializing or retrying) sock = new ws(addr); sock.on('open', () => { sockdown = false; self.emit('open'); }); - sock.on('close', (err) => { console.log(err); setTimeout(sockinit,1000); sockdown = true; self.emit('close'); }); - sock.on('error', (err) => { console.log(err); sock.close(); }); + sock.on('close', (err) => { console.log('close', err); setTimeout(sockinit,1000); sockdown = true; self.emit('close'); }); + sock.on('error', (err) => { console.log('error', err); sock.close(); }); sock.on('message', (message) => { self.emit('message',message);}); } sockinit(); |