discord_luau/websocket

Discord Luau Websocket - Implementation of the websocket for discord.

discord-luau

Implementation of the Discord WebSocket gateway connection, providing multi-shard management, heartbeating, session resumption, and event dispatch.

Source: packages/websocket

Installation

pesde add discord_luau/websocket

Example

local WebSocket = require("./luau_packages/websocket")

local manager = WebSocket.manager.new({
	token = botToken,
	intents = 513,
	webSocketVersion = 10,
	largeThreshold = 250,
	reconnect = true,
})

manager.onAllShardsReady:listen(function()
	print("All shards ready")
end)

manager.onDispatch:listen(function(payload)
	print("Event:", payload.event)
end)

manager:connectAsync(gatewayInfo):await()

Full documentation at discordluau-docs.devcomp.workers.dev.

Contributing

Contributions are welcome via the repository at github.com/DiscordLuau/discord-luau.

License

This package is licensed under the MIT License.