Files
revanced-bots/apis/websocket/docs/3_packets.md
2024-06-24 18:23:14 +07:00

1.3 KiB

📨 Packets

Packets are BSON messages sent to the server. They're structured like the following when decoded:

{
    "op": 12345,
    "d": {
        "some_field": "some data"
    }
}

packet.op

Operation codes are numbers that communicate an action.

packet.d

Data fields include additional information for the server to process. They are either an object with specific fields or just null.

📦 Schemas and constants

Schemas for packets and their respective data1 , and the list of possible operation codes2 can be found in the @revanced/bot-shared package, with typings as well.

💓 Heartbeating

Heartbeating is a process where the client regularly send each other signals to confirm that they are still connected and functioning. If the server doesn't receive a heartbeat from the client within a specified timeframe, it assume the client has disconnected and closes the socket.

You can configure the interval in the configuration file. See 📝 Configuration > config.clientHeartbeatInterval.