Constantsnamespace
Opcodes, intents, close codes, activity types and other gateway constants.
On this page
import { Constants } from 'detritus-client-socket';Enums
Named constants.
CryptoModules
enum src/constants.ts:23DaveCodecs
enum src/constants.ts:513DaveMediaTypes
enum src/constants.ts:508EncodingTypes
enum src/constants.ts:37GatewayActivityActionTypes
enum src/constants.ts:42GatewayActivityFlags
enum src/constants.ts:51GatewayActivityTypes
enum src/constants.ts:66GatewayCapabilities
enum src/constants.ts:194GatewayDispatchEvents
enum src/constants.ts:76GatewayIntents
enum src/constants.ts:214GatewayOpCodes
enum src/constants.ts:312GatewayPresenceStatuses
enum src/constants.ts:359MediaCodecs
enum src/constants.ts:378MediaCodecTypes
enum src/constants.ts:373MediaDaveProposalsOperationTypes
enum src/constants.ts:423MediaEncryptionModes
enum src/constants.ts:397MediaFlags
enum src/constants.ts:429MediaOpCodes
enum src/constants.ts:435MediaPlatforms
enum src/constants.ts:472MediaProtocols
enum src/constants.ts:480MediaSpeakingFlags
enum src/constants.ts:494MediaSSRCTypes
enum src/constants.ts:502MediaStreamTypes
enum src/constants.ts:523RTCPPacketTypes
enum src/constants.ts:698RTCPPayloadFeedbackTypes
enum src/constants.ts:690RTCPTransportFeedbackTypes
enum src/constants.ts:682RTPPayloadTypes
enum src/constants.ts:670SocketCloseCodes
enum src/constants.ts:562SocketEvents
enum src/constants.ts:530SocketEventsBase
enum src/constants.ts:553SocketGatewayCloseCodes
enum src/constants.ts:604SocketInternalCloseCodes
enum src/constants.ts:579SocketMediaCloseCodes
enum src/constants.ts:621SocketStates
enum src/constants.ts:658The connection state of a gateway or voice gateway socket, emitted as state
CLOSEDno socket. Never connected, waiting out a reconnect backoff, waiting for a new voice server, or dead for good, checkkilledto tell the last one apartCONNECTINGthe websocket handshake is in progressOPENthe websocket is open, waiting for HELLO or foronIdentifyCheckto allow identifyingIDENTIFYING/RESUMINGIDENTIFY/RESUME was sent, waiting for READY/RESUMEDREADYthe session is up. For voice that doesn't mean audio can be sent yet, wait fortransportReady
Values cross process boundaries (clustering), so members are never renamed or inserted
Variables
Exported values.
ApiVersions
variable const src/constants.ts:10const ApiVersions: Readonly<{ GATEWAY: 10; MEDIA_GATEWAY: 8 }>Show definition (4 lines)
export const ApiVersions = Object.freeze({
GATEWAY: 10,
MEDIA_GATEWAY: 8,
});COMPRESS_TYPES
variable const src/constants.ts:21const COMPRESS_TYPES: readonly CompressTypes[]DAVE_MODULE
variable const src/constants.ts:28const DAVE_MODULE: "@snazzah/davey" = '@snazzah/davey'DEFAULT_HANDSHAKE_TIMEOUT
variable const src/constants.ts:30const DEFAULT_HANDSHAKE_TIMEOUT: 30000 = 30000DEFAULT_HELLO_TIMEOUT
variable const src/constants.ts:31const DEFAULT_HELLO_TIMEOUT: 30000 = 30000DEFAULT_RECONNECT_DELAY_MAX
variable const src/constants.ts:32const DEFAULT_RECONNECT_DELAY_MAX: 60000 = 60000DEFAULT_SHARD_COUNT
variable const src/constants.ts:33const DEFAULT_SHARD_COUNT: 1 = 1DEFAULT_SHARD_LAUNCH_DELAY
variable const src/constants.ts:34const DEFAULT_SHARD_LAUNCH_DELAY: 5000 = 5000DEFAULT_VOICE_TIMEOUT
variable const src/constants.ts:35const DEFAULT_VOICE_TIMEOUT: 30000 = 30000GATEWAY_INTENTS_ALL
variable const src/constants.ts:240const GATEWAY_INTENTS_ALL: GatewayIntentsShow definition (23 lines)
export const GATEWAY_INTENTS_ALL = [
GatewayIntents.GUILDS,
GatewayIntents.GUILD_MEMBERS,
GatewayIntents.GUILD_BANS,
GatewayIntents.GUILD_EMOJIS,
GatewayIntents.GUILD_INTEGRATIONS,
GatewayIntents.GUILD_WEBHOOKS,
GatewayIntents.GUILD_INVITES,
GatewayIntents.GUILD_VOICE_STATES,
GatewayIntents.GUILD_PRESENCES,
GatewayIntents.GUILD_MESSAGES,
GatewayIntents.GUILD_MESSAGE_REACTIONS,
GatewayIntents.GUILD_MESSAGE_TYPING,
GatewayIntents.DIRECT_MESSAGES,
GatewayIntents.DIRECT_MESSAGE_REACTIONS,
GatewayIntents.DIRECT_MESSAGE_TYPING,
GatewayIntents.MESSAGE_CONTENT,
GatewayIntents.GUILD_SCHEDULED_EVENTS,
GatewayIntents.AUTO_MODERATION_CONFIGURATION,
GatewayIntents.AUTO_MODERATION_EXECUTION,
GatewayIntents.GUILD_MESSAGE_POLLS,
GatewayIntents.DIRECT_MESSAGE_POLLS,
].reduce((x, total) => total | x);GATEWAY_INTENTS_ALL_DIRECT_MESSAGES
variable const src/constants.ts:285const GATEWAY_INTENTS_ALL_DIRECT_MESSAGES: GatewayIntentsShow definition (6 lines)
export const GATEWAY_INTENTS_ALL_DIRECT_MESSAGES = [
GatewayIntents.DIRECT_MESSAGES,
GatewayIntents.DIRECT_MESSAGE_REACTIONS,
GatewayIntents.DIRECT_MESSAGE_TYPING,
GatewayIntents.DIRECT_MESSAGE_POLLS,
].reduce((x, total) => total | x);GATEWAY_INTENTS_ALL_GUILD
variable const src/constants.ts:292const GATEWAY_INTENTS_ALL_GUILD: GatewayIntentsShow definition (18 lines)
export const GATEWAY_INTENTS_ALL_GUILD = [
GatewayIntents.GUILDS,
GatewayIntents.GUILD_MEMBERS,
GatewayIntents.GUILD_BANS,
GatewayIntents.GUILD_EMOJIS,
GatewayIntents.GUILD_INTEGRATIONS,
GatewayIntents.GUILD_WEBHOOKS,
GatewayIntents.GUILD_INVITES,
GatewayIntents.GUILD_VOICE_STATES,
GatewayIntents.GUILD_PRESENCES,
GatewayIntents.GUILD_MESSAGES,
GatewayIntents.GUILD_MESSAGE_REACTIONS,
GatewayIntents.GUILD_MESSAGE_TYPING,
GatewayIntents.GUILD_SCHEDULED_EVENTS,
GatewayIntents.AUTO_MODERATION_CONFIGURATION,
GatewayIntents.AUTO_MODERATION_EXECUTION,
GatewayIntents.GUILD_MESSAGE_POLLS,
].reduce((x, total) => total | x);GATEWAY_INTENTS_ALL_UNPRIVILEGED
variable const src/constants.ts:264const GATEWAY_INTENTS_ALL_UNPRIVILEGED: GatewayIntentsShow definition (20 lines)
export const GATEWAY_INTENTS_ALL_UNPRIVILEGED = [
GatewayIntents.GUILDS,
GatewayIntents.GUILD_BANS,
GatewayIntents.GUILD_EMOJIS,
GatewayIntents.GUILD_INTEGRATIONS,
GatewayIntents.GUILD_WEBHOOKS,
GatewayIntents.GUILD_INVITES,
GatewayIntents.GUILD_VOICE_STATES,
GatewayIntents.GUILD_MESSAGES,
GatewayIntents.GUILD_MESSAGE_REACTIONS,
GatewayIntents.GUILD_MESSAGE_TYPING,
GatewayIntents.DIRECT_MESSAGES,
GatewayIntents.DIRECT_MESSAGE_REACTIONS,
GatewayIntents.DIRECT_MESSAGE_TYPING,
GatewayIntents.GUILD_SCHEDULED_EVENTS,
GatewayIntents.AUTO_MODERATION_CONFIGURATION,
GatewayIntents.AUTO_MODERATION_EXECUTION,
GatewayIntents.GUILD_MESSAGE_POLLS,
GatewayIntents.DIRECT_MESSAGE_POLLS,
].reduce((x, total) => total | x);MaxNumbers
variable const src/constants.ts:367const MaxNumbers: Readonly<{ UINT16: 65535; UINT32: 4294967295; UINT8: 255 }>Show definition (5 lines)
export const MaxNumbers = Object.freeze({
UINT8: 0xFF,
UINT16: 0xFFFF,
UINT32: 0xFFFFFFFF,
});MEDIA_CODECS_AUDIO
variable const src/constants.ts:387const MEDIA_CODECS_AUDIO: MediaCodecs[]Show definition (3 lines)
export const MEDIA_CODECS_AUDIO = [
MediaCodecs.OPUS,
];MEDIA_CODECS_VIDEO
variable const src/constants.ts:391const MEDIA_CODECS_VIDEO: MediaCodecs[]Show definition (5 lines)
export const MEDIA_CODECS_VIDEO = [
MediaCodecs.VP8,
MediaCodecs.VP9,
MediaCodecs.H264,
];MEDIA_ENCRYPTION_MODES
variable const src/constants.ts:408const MEDIA_ENCRYPTION_MODES: readonly MediaEncryptionModes[]Show definition (4 lines)
export const MEDIA_ENCRYPTION_MODES = Object.freeze([
MediaEncryptionModes.AEAD_AES256_GCM_RTPSIZE,
MediaEncryptionModes.AEAD_XCHACHA20_POLY1305_RTPSIZE,
]);MEDIA_PROTOCOLS
variable const src/constants.ts:485const MEDIA_PROTOCOLS: readonly MediaProtocols[]MediaDaveTransition
variable const src/constants.ts:413const MediaDaveTransition: Readonly<{ EXPIRY: 10; EXPIRY_PENDING_DOWNGRADE: 24; FAILURE_TOLERANCE: 36; MAX_INVALID_TRANSITIONS: 5 }>Show definition (9 lines)
export const MediaDaveTransition = Object.freeze({
// seconds
EXPIRY: 10,
EXPIRY_PENDING_DOWNGRADE: 24,
// consecutive decryption failures before we try to recover
FAILURE_TOLERANCE: 36,
// consecutive invalid commits/welcomes before we reconnect, like discord's client
MAX_INVALID_TRANSITIONS: 5,
});MediaReceivedVideoQuality
variable const src/constants.ts:487const MediaReceivedVideoQuality: Readonly<{ FULL: "full"; OFF: "off" }>Show definition (4 lines)
export const MediaReceivedVideoQuality = Object.freeze({
OFF: 'off',
FULL: 'full',
});MediaSilencePacket
variable const src/constants.ts:492const MediaSilencePacket: number[]Package
variable const src/constants.ts:4const Package: Readonly<{ URL: "https://github.com/detritusjs/client-socket"; VERSION: string }>Show definition (4 lines)
export const Package = Object.freeze({
URL: 'https://github.com/detritusjs/client-socket',
VERSION: version,
});RTCP_HEADER_VERSION
variable const src/constants.ts:679const RTCP_HEADER_VERSION: 128 = 0x80RTCP_PACKET_TYPES
variable const src/constants.ts:708const RTCP_PACKET_TYPES: readonly (string | SENDER_REPORT | RECEIVER_REPORT | SOURCE_DESCRIPTION | BYE | APP | RTPFB | PSFB)[]RTP_HEADER_VERSION
variable const src/constants.ts:668const RTP_HEADER_VERSION: 128 = 0x80RTP_PAYLOAD_TYPES
variable const src/constants.ts:677RTPHeaderExtensionOneByte
variable const src/constants.ts:710const RTPHeaderExtensionOneByte: Readonly<{ HEADER: number[]; LOCAL_IDENTIFER: 15 }>Show definition (4 lines)
export const RTPHeaderExtensionOneByte = Object.freeze({
HEADER: [0xBE, 0xDE],
LOCAL_IDENTIFER: 0xF,
});RTPHeaderExtensionTwoByte
variable const src/constants.ts:715const RTPHeaderExtensionTwoByte: Readonly<{ HEADER: number[] }>Show definition (3 lines)
export const RTPHeaderExtensionTwoByte = Object.freeze({
HEADER: [0x10, 0x00],
});SocketInternalCloseReasons
variable const src/constants.ts:592const SocketInternalCloseReasons: Readonly<{ -1: "Gateway Error, check `warn` listener"; 4900: "Invalid data received, reconnecting"; 4901: "Reconnecting"; 4902: "Heartbeat ACK never arrived"; 4903: "Invalid nonce received by Heartbeat ACK"; 4904: "Received message from not our current socket"; 4905: "Received open from not our current socket"; 4906: "Received Invalid Session that is not resumable"; 4907: "Too many invalid DAVE commits/welcomes in a row, reconnecting" }>Show definition (11 lines)
export const SocketInternalCloseReasons = Object.freeze({
[SocketInternalCloseCodes.CONNECTION_ERROR]: 'Gateway Error, check `warn` listener',
[SocketInternalCloseCodes.INVALID_DATA]: 'Invalid data received, reconnecting',
[SocketInternalCloseCodes.RECONNECTING]: 'Reconnecting',
[SocketInternalCloseCodes.HEARTBEAT_ACK]: 'Heartbeat ACK never arrived',
[SocketInternalCloseCodes.HEARTBEAT_ACK_NONCE]: 'Invalid nonce received by Heartbeat ACK',
[SocketInternalCloseCodes.OTHER_SOCKET_MESSAGE]: 'Received message from not our current socket',
[SocketInternalCloseCodes.OTHER_SOCKET_OPEN]: 'Received open from not our current socket',
[SocketInternalCloseCodes.INVALID_SESSION_NON_RESUMABLE]: 'Received Invalid Session that is not resumable',
[SocketInternalCloseCodes.DAVE_INVALID_TRANSITIONS]: 'Too many invalid DAVE commits/welcomes in a row, reconnecting',
});ZLIB_SUFFIX
variable const src/constants.ts:719const ZLIB_SUFFIX: number[]