WebSocketShard

export class WebSocketShard extends EventEmitter
export class WebSocketShard extends EventEmitter
Represents a Shard's WebSocket connection

Extends

EventEmitter
allReady
Emitted when the shard is fully ready. This event is emitted if:* all guilds were received by this shard* the ready timeout expired, and some guilds are unavailable
NameTypeOptionalDescription
unavailableGuildsSet<string> | nullNoSet of unavailable guilds, if any
close
Emitted when a shard's WebSocket closes.
NameTypeOptionalDescription
eventCloseEventNoThe received event
ready
Emitted when the shard receives the READY payload and is now waiting for guilds
resumed
Emitted when the shard resumes successfully
The shard's id
lastPingTimestamp:number
The last time a ping was sent (a timestamp)
The WebSocketManager of the shard
ping:number
The previous heartbeat ping of the shard
status:Status
The current status of the shard
Deprecated
emitClose(event?):
yes
Deprecated
This method is responsible to emit close event for this shard. This method helps the shard reconnect.
NameTypeOptionalDescription
eventCloseEventYesClose event that was received
on(event, listener):this
NameTypeOptionalDescription
eventEventNoNone
listener(...args: WebSocketShardEventTypes[Event]) => voidNoNone
once(event, listener):this
NameTypeOptionalDescription
eventEventNoNone
listener(...args: WebSocketShardEventTypes[Event]) => voidNoNone
send(data, important?):void
Adds a packet to the queue to be sent to the gateway. If you use this method, make sure you understand that you need to provide a full [Payload](https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-commands). Do not use this method if you don't know what you're doing.
NameTypeOptionalDescription
dataunknownNoThe full packet to send
importantbooleanYesIf this packet should be added first in queue This parameter is **deprecated**. Important payloads are determined by their opcode instead.