forward events from STP
parent
b1e0cf7ddd
commit
35df090d17
|
|
@ -63,6 +63,8 @@ class STPSocket extends EventEmitter {
|
||||||
else this.tcpSocket.on('connect', this.handshake.bind(this));
|
else this.tcpSocket.on('connect', this.handshake.bind(this));
|
||||||
|
|
||||||
this.tcpSocket.on('data', this.data.bind(this));
|
this.tcpSocket.on('data', this.data.bind(this));
|
||||||
|
this.tcpSocket.on('error', (...args) => this.emit('error', ...args));
|
||||||
|
this.tcpSocket.on('close', (...args) => this.emit('close', ...args));
|
||||||
}
|
}
|
||||||
|
|
||||||
data(evt) {
|
data(evt) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ let client = null;
|
||||||
client = null;
|
client = null;
|
||||||
setTimeout(tryConnect, 1000);
|
setTimeout(tryConnect, 1000);
|
||||||
});
|
});
|
||||||
|
client.on('close', () => {
|
||||||
|
log.error(`connection closed on ${config.addresses.relay}`)
|
||||||
|
client = null;
|
||||||
|
setTimeout(tryConnect, 1000);
|
||||||
|
});
|
||||||
client.on('data', (data) => {
|
client.on('data', (data) => {
|
||||||
log.debug(data.toString());
|
log.debug(data.toString());
|
||||||
})
|
})
|
||||||
|
|
@ -55,10 +60,12 @@ app.get('/', (req, res) => {
|
||||||
<td><pre>${client.remoteAddress}</pre></td>
|
<td><pre>${client.remoteAddress}</pre></td>
|
||||||
<td><pre>${client.remoteIdentity}</pre></td>
|
<td><pre>${client.remoteIdentity}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
`)}
|
`).join('')}
|
||||||
</table>
|
</table>
|
||||||
`);
|
`);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// app.post
|
||||||
|
|
||||||
app.listen(9999);
|
app.listen(9999);
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue