class WebSocketShard

extends

EventEmitter
export class WebSocketShard extends EventEmitter

Represents a Shard's WebSocket connection

id : number

The shard's id

lastPingTimestamp : number

The last time a ping was sent (a timestamp)

manager : WebSocketManager

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?: CloseEvent
) :

This method is responsible to emit close event for this shard. This method helps the shard reconnect.

on<

Event extends keyof WebSocketShardEventTypes

>(
event: Event
listener: (...args: WebSocketShardEventTypes[Event]) => Awaitable<void>
) : this

once<

Event extends keyof WebSocketShardEventTypes

>(
event: Event
listener: (...args: WebSocketShardEventTypes[Event]) => Awaitable<void>
) : this

send(
data: unknown
important?: boolean
) : 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.

allReady(
unavailableGuilds: Set<string>
)

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

close(
event: CloseEvent
)

Emitted when a shard's WebSocket closes.

ready()

Emitted when the shard receives the READY payload and is now waiting for guilds

resumed()

Emitted when the shard resumes successfully