diff options
-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(); |