Class
WebSocketShard
Extends EventEmitter
Constructor
new WebSocketShard
(options: WebSocketShardOptions)| Param | Type | Description |
|---|---|---|
| options | WebSocketShardOptions |
Properties
debugEnabled
: boolean (readonly)heartbeatInterval
: ReturnType<typeof setInterval> | nullheartbeatTimeout
: ReturnType<typeof setTimeout> | nullid
: number (readonly)lastHeartbeatAck
: booleanTrue until a heartbeat is sent; cleared by HeartbeatAck.
options
: WebSocketShardOptions (readonly)phase
: PhasereconnectDelayMs
: numberreconnectTimeout
: ReturnType<typeof setTimeout> | nullseq
: number | nullsessionId
: string | nullstatus
: number (readonly)Mapped readyState: 0 idle/closed, 1 connecting, 2 open, 3 closing.
url
: string (readonly)ws
: WebSocketLike | nullWS
: WebSocketConstructor (readonly)Methods
bindSocket
(ws: WebSocketLike): boolean| Param | Type | Description |
|---|---|---|
| ws | WebSocketLike |
clearReconnectTimer
(): voidconnect
(): voiddebug
(message: string): void| Param | Type | Description |
|---|---|---|
| message | string |
destroy
(): voidhandleDispatch
(payload: GatewayReceivePayload): void| Param | Type | Description |
|---|---|---|
| payload | GatewayReceivePayload |
handleHello
(value: unknown): void| Param | Type | Description |
|---|---|---|
| value | unknown |
handlePayload
(payload: GatewayReceivePayload): void| Param | Type | Description |
|---|---|---|
| payload | GatewayReceivePayload |
onClose
(code: number): void| Param | Type | Description |
|---|---|---|
| code | number |
onMessage
(raw: unknown): void| Param | Type | Description |
|---|---|---|
| raw | unknown |
onOpen
(): voidonSocketError
(err?: unknown): void| Param | Type | Description |
|---|---|---|
| err? | unknown |
scheduleReconnect
(): voidsend
(payload: GatewaySendPayload): void| Param | Type | Description |
|---|---|---|
| payload | GatewaySendPayload |
sendHeartbeat
(): voidstopHeartbeat
(): void