Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Latest commit

 

History

History
201 lines (155 loc) · 3.7 KB

protocol.md

File metadata and controls

201 lines (155 loc) · 3.7 KB

Websocket protocol

The word "packet" refers to the data being sent over the websocket connection and not minecraft packets
Format: JSON

Base Packet Structure

{
  "id": "packet_id (integer)",
  "data": "anything (any type)"
}

Where packet_id is one of the following enum entries

enum PacketId {
    PACKETLOGGER_LOGSTATE,
    MC_PACKET_RECEIVED,
    MC_PACKET_SENT,
    REQUEST_MC_PACKET_INFO,
    MC_PACKET_INFO,
    REQUEST_CLEAR,
    REQUEST_EXPORT,
    WHITE_BLACK_LIST_CONFIRM,
    WHITE_BLACK_LIST_CHANGE
}

Client -> Web

packetlogger_logstate

Confirms / Changes the state of the packetlogger

{
  "id": 0,
  "data": 0
}

Enum being used for future uses. Values correspond to the following enum:

enum LogState {
    OFF = 0,
    LOGGING = 1
}

mc_packet_received

[packet id, unix milli-timestamp, unique index, networkstate, direction]

  • Unique index will be used for later referencing through the request_mc_packet_info packet
  • NetworkState is the network state of the packet. See enum below
  • Direction is the direction of the packet. 0 = client -> server, 1 = server -> client
{
  "id": 1,
  "data": [[0, 1234567890, 9, 0, 0], [1, 123456790, 10, 0, 0]]
}

Networkstate Enum:

public enum NetworkState {
    HANDSHAKING,
    PLAY,
    STATUS,
    LOGIN
}

mc_packet_sent

[packet id, unix milli-timestamp, unique index, networkstate, direction]

  • Unique index will be used for later referencing through the request_mc_packet_info packet
  • NetworkState is the network state of the packet. See enum below
  • Direction is the direction of the packet. 0 = client -> server, 1 = server -> client
{
  "id": 2,
  "data": [[0, 1234567890, 9, 0, 0], [1, 123456790, 10, 0, 0]]
}

Networkstate Enum:

public enum NetworkState {
    HANDSHAKING,
    PLAY,
    STATUS,
    LOGIN
}

mc_packet_info

{
  "id": 4,
  "data": {
    "index": 0,
    "packetData": {
      "reset": true,
      "advancementMapping": [
        "..."
      ],
      "toRemove": [
        "..."
      ],
      "...": "..."
    }
  }
}

white_black_list_confirm

Confirms the state of the white/blacklist. Will be sent after each white_black_list_change packet. White/Blacklist entry is given in the following format: (cbound|sbound)-(play|login|status|handshake)-0x[0-9a-f]{2}

{
  "id": 7,
  "data": {
    "whitelist": ["cbound-play-0x01", "sbound-play-0x02", "..."],
    "blacklist": ["cbound-play-0x03", "sbound-play-0x04", "..."]
  }
}

Web -> Client

packetlogger_logstate

Uses same packet structure as client -> web packetlogger_logstate packet

{
  "id": 0,
  "data": 0
}

request_mc_packet_info

Data specifies an index given by mc_packet_received or mc_packet_sent packet

{
  "id": 3,
  "data": 1
}

request_clear

Tells the client to clear all stored packets

{
  "id": 5,
  "data": null
}

request_export

Tells the client to export all stored packets. If whitelist is not empty, only packets in the whitelist shall be included. If blacklist is not empty, all packets in the blacklist shall be excluded

{
  "id": 6
}

white_black_list_change

Will be sent whenever the frontend changes the whitelist/blacklist. MC Client responds with a white_black_list_confirm packet containing updated white/blacklist data.

{
  "id": 8,
  "data": {
    "whitelist": ["cbound-play-0x01", "sbound-play-0x02", "..."],
    "blacklist": ["cbound-play-0x03", "sbound-play-0x04", "..."]
  }
}