Skip to content

GatewayOptions

Defined in: packages/ws/src/index.ts:85

Gateway connection configuration.

optional compress?: boolean

Defined in: packages/ws/src/index.ts:122

Whether to enable zlib-stream transport compression. Decoded with a persistent node:zlib inflate stream, matching Discord’s zlib-wrapped stream framing (Z_SYNC_FLUSH boundaries). When enabled, appends &compress=zlib-stream to the Gateway URL.


optional connectTimeout?: number

Defined in: packages/ws/src/index.ts:99

How long a socket may stay connecting before it is closed and retried, in ms. Default 30000.


optional createSocket?: SocketFactory

Defined in: packages/ws/src/index.ts:127

Constructs the underlying socket. Defaults to the ambient WebSocket. Injected to run the Gateway on an alternative transport, or on a stub.


optional heartbeatAckTimeout?: number

Defined in: packages/ws/src/index.ts:105

Heartbeat acknowledgement timeout.


intents: GatewayIntentResolvable

Defined in: packages/ws/src/index.ts:89

Gateway intent bitfield or resolvable.


optional maxReconnectAttempts?: number

Defined in: packages/ws/src/index.ts:97

Maximum reconnect attempts.


optional presence?: GatewayPresence

Defined in: packages/ws/src/index.ts:115

Presence data.


optional properties?: GatewayProperties

Defined in: packages/ws/src/index.ts:113

Identification properties.


optional reconnect?: boolean

Defined in: packages/ws/src/index.ts:95

Whether automatic reconnect is enabled.


optional reconnectBaseDelay?: number

Defined in: packages/ws/src/index.ts:101

Initial reconnect delay.


optional reconnectMaxDelay?: number

Defined in: packages/ws/src/index.ts:103

Maximum reconnect delay.


optional reconnectStormLimit?: number

Defined in: packages/ws/src/index.ts:109

Reconnects inside reconnectStormWindow after which the link counts as unstable: unstable is emitted and the delay keeps doubling. Default 5.


optional reconnectStormWindow?: number

Defined in: packages/ws/src/index.ts:111

The span over which reconnects are counted for storm detection, in ms. Default 60,000.


optional shardCount?: number

Defined in: packages/ws/src/index.ts:93

Total shard count.


optional shardId?: number

Defined in: packages/ws/src/index.ts:91

Shard identifier.


token: string

Defined in: packages/ws/src/index.ts:87

Authentication token.


optional zombieTimeout?: number

Defined in: packages/ws/src/index.ts:107

Zombie connection timeout.