readded docs for Client#error and Client#ready (#1466)

This commit is contained in:
SpaceEEC
2017-05-05 20:15:06 +02:00
committed by Crawl
parent 7d7f1b2446
commit 6cd55ed5c9

View File

@@ -115,6 +115,10 @@ class WebSocketConnection extends EventEmitter {
this.debug('Tried to mark self as ready, but already ready');
return;
}
/**
* Emitted when the client becomes ready to start working.
* @event Client#ready
*/
this.status = Constants.Status.READY;
this.client.emit(Constants.Events.READY);
this.packetManager.handleQueue();
@@ -354,6 +358,11 @@ class WebSocketConnection extends EventEmitter {
* @param {Error} error Error that occurred
*/
onError(error) {
/**
* Emitted whenever the client's WebSocket encounters a connection error.
* @event Client#error
* @param {Error} error The encountered error
*/
this.client.emit(Constants.Events.ERROR, error);
if (error.message === 'uWs client connection error') this.reconnect();
}