Skip to Content
Gateway

Gateway

Endpoints

  • wss://gateway.foxogram.su - Production
  • wss://gateway.dev.foxogram.su - Development

Opcodes (op)

  • 0 - Dispatch
  • 1 - Identify
  • 2 - Hello
  • 3 - Heartbeat
  • 4 - Heartbeat ACK

Events (t)

  • MESSAGE_CREATE
  • MESSAGE_UPDATE
  • MESSAGE_DELETE
  • CHANNEL_CREATE
  • CHANNEL_UPDATE
  • CHANNEL_DELETE
  • MEMBER_ADD
  • MEMBER_REMOVE
  • MEMBER_UPDATE

Error codes

  • 4001 - Unauthorized
  • 4002 - Heartbeat Timeout

Message structure

FieldDescription
opOpcode
dData
s?Sequence number
t?Event name

s and t are null when op is not 0 (Dispatch)

Send

{ "op": 2, "d": {} }

Receive

{ "op": 0, "d": {}, "s": 42, "t": "EVENT_NAME" }

Examples

Send events

Identify

{ "op": 1, "d": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjowfQ.mpOO0N5hjaKrSl8EK16aFxSb_pqOUXVCQLNEt3-JBWg" } }

Heartbeat

{ "op": 3 }

Receive events

Hello

{ "op": 2, "d": { "heartbeat_interval": 30000 } }

heartbeat_interval value in milliseconds

Heartbeat ACK

{ "op": 4 }

Dispatch events

Message create

{ "op": 0, "d": {}, "s": 42, "t": "MESSAGE_CREATE" }

d type of message object

Connection lifecycle