This commit is contained in:
syuilo 2018-02-26 19:23:53 +09:00
parent 76db93d690
commit d939e552f3
8 changed files with 47 additions and 39 deletions

View file

@ -23,6 +23,14 @@ export default abstract class StreamManager<T extends Connection> extends EventE
this.emit('disconnected');
} else {
this.emit('connected', this._connection);
this._connection.on('_connected_', () => {
this.emit('_connected_');
});
this._connection.on('_disconnected_', () => {
this.emit('_disconnected_');
});
}
}
@ -37,6 +45,11 @@ export default abstract class StreamManager<T extends Connection> extends EventE
return this._connection != null;
}
public get state(): string {
if (!this.hasConnection) return 'no-connection';
return this._connection.state;
}
/**
*
*/