more socket.io things.

This commit is contained in:
Christopher Jeffrey 2016-05-27 01:05:44 -07:00
parent 0e31719d13
commit b7bc1cfe77
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 11 additions and 3 deletions

View File

@ -140,7 +140,7 @@ HTTPClient.prototype.listenWallet = function listenWallet(id) {
if (!this.socket)
return;
this.socket.join(id);
this.socket.emit('join', id);
};
/**
@ -152,7 +152,7 @@ HTTPClient.prototype.unlistenWallet = function unlistenWallet(id) {
if (!this.socket)
return;
this.socket.leave(id);
this.socket.emit('leave', id);
};
/**

View File

@ -663,6 +663,14 @@ HTTPServer.prototype._initIO = function _initIO() {
self.emit('error', err);
});
socket.on('join', function(id) {
socket.join(id);
});
socket.on('leave', function(id) {
socket.leave(id);
});
self.emit('websocket', socket);
socket.emit('version', {
@ -771,7 +779,7 @@ HTTPServer.prototype.listen = function listen(port, host, callback) {
return self.emit('error', err);
}
bcoin.debug('Listening - host=%s port=%d',
bcoin.debug('HTTP server listening on %s (port=%d).',
address.address, address.port);
self.loaded = true;