Skip to content

DiscordShard

DiscordShard is an internal class responsible for managing the connection and communication with a specific shard of the Discord WebSocket. This class handles events, errors, and operations specific to a shard.

Properties

discordWebsocket

DiscordShard.discordWebsocket  :: Network.DiscordWebsocket

websocketUrl

DiscordShard.websocketUrl  :: string

reporter

DiscordShard.reporter  :: Vendor.Console

heartbeatTask

DiscordShard.heartbeatTask  :: thread?

resumeSessionId

DiscordShard.resumeSessionId  :: string

dispatchSequence

DiscordShard.dispatchSequence  :: number

heartbeatInterval

DiscordShard.heartbeatInterval  :: number

heartbeatClockTime

DiscordShard.heartbeatClockTime  :: number

heartbeatPing

DiscordShard.heartbeatPing  :: number

identified

DiscordShard.identified  :: boolean?

resumeGatewayUrl

DiscordShard.resumeGatewayUrl  :: string

heartbeatAck

DiscordShard.heartbeatAck  :: boolean?

activeConnections

DiscordShard.activeConnections  :: { unknown }

onEvent

DiscordShard.onEvent  :: Vendor.Signal<string, { [any]: any }>

onIdentified

DiscordShard.onIdentified  :: Vendor.Signal

shardId

DiscordShard.shardId  :: number

Methods

observeWebsocketErrors

DiscordShard : observeWebsocketErrors ()  -> ()

Observes and handles WebSocket errors.

observeWebsocketEvents

DiscordShard : observeWebsocketEvents ()  -> ()

Observes and handles WebSocket events.

observeWebsocketOperations

DiscordShard : observeWebsocketOperations ()  -> ()

Observes and handles WebSocket operations.

initiateWebsocket

DiscordShard : initiateWebsocket ()  -> ()

Initiates the WebSocket connection.

heartbeatAsync

DiscordShard : heartbeatAsync (

     ignoreHeartbeatAck: boolean?
)  -> Vendor.Future

Sends a heartbeat to the Discord WebSocket.

heartbeatIn

DiscordShard : heartbeatIn (

     milliseconds: number
)  -> ()

Schedules the next heartbeat.

identifyAsync

DiscordShard : identifyAsync ()  -> Vendor.Future

Identifies the Discord client with the Discord WebSocket.

connectAsync

DiscordShard : connectAsync (

     websocketUrl: string
)  -> Vendor.Future

Connects the DiscordShard to the Discord WebSocket.

resumeAsync

DiscordShard : resumeAsync ()  -> Vendor.Future

Resumes a previous session with the Discord WebSocket.

reconnectAsync

DiscordShard : reconnectAsync ()  -> Vendor.Future

Attempts to reconnect the DiscordShard to the Discord WebSocket.

Functions

new

DiscordShard . new (

     discordClient: any
     shardId: number
)  -> ()

Creates a new instance of DiscordShard.