ClientWebSocket

ClientWebSocket

ClientWebSocket

Constructor

(private) new ClientWebSocket(client) → {ClientWebSocket}

Create a new WebSocket connection

Source:
Parameters:
Name Type Description
client Client

The client object

Returns:
Type:
ClientWebSocket

The ClientWebSocket object

Extends

  • EventEmitter

Members

(private) botID :string

The bot's ID

Source:
Type:
  • string

(private) client :Client

The client object

Source:
Type:

(private, readonly) connected :boolean

Whether the WebSocket is connected or not

Source:
Type:
  • boolean

(private, readonly) currentReconnectTries :Number

The current number of tries to reconnect

Source:
Type:
  • Number

(private) heartbeatInterval :Number

The heartbeat interval

Source:
Type:
  • Number

(private, readonly) lastHeartbeat :Number

The last heartbeat sent

Source:
Type:
  • Number

(private, readonly) lastHeartbeatAck :Number

The last heartbeat acknowledged

Source:
Type:
  • Number

(private, readonly) lastHeartbeatReceived :Number

The last heartbeat received

Source:
Type:
  • Number

(private, readonly) reconnectTries :Number

Number of max tries to reconnect

Default Value:
  • Infinity
Source:
Type:
  • Number

(private) ws :WebSocket

The WebSocket connection

Source:
Type:
  • WebSocket

Methods

(async, private) connect() → {Promise.<void>}

Connects the bot to the Guilded API

Source:
Returns:
Type:
Promise.<void>
Examples
client.ws.connect();
client.ws.connect().then(() => {
  console.log('Bot is ready!');
});