Skip to content

Instantly share code, notes, and snippets.

@jocopa3
Created February 11, 2017 18:46
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jocopa3/54b42fb6361952997c4a6e38945e306f to your computer and use it in GitHub Desktop.
Save jocopa3/54b42fb6361952997c4a6e38945e306f to your computer and use it in GitHub Desktop.
MCPE/Win10 WebSocket JSON Messages
// For more information about available commands, look at the commands/standard.json file in the game's assets.
{
"body": {
"input": {}, // Command inputs go here
"origin": {
"type": "player" // Where the command originates from
},
"name": "name-of-command", // Command name goes here (i.e. for /say, enter "say")
"version": 1,
"overload": "default" // If the command has additional overloads defined, you can specify it here
},
"header": {
"requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"messagePurpose": "commandRequest", // Note that both messagePurpose and messageType are "commandRequest"
"version": 1,
"messageType": "commandRequest"
}
}
// Note: the body for this command usually has extra data, but that data looks different for each command
{
"body": {
"statusCode": 0, // Whether the command executed successfully, or if an error occured
"statusMessage": "response message" // Some command reponses may not have a status message
},
"header": {
"messagePurpose": "commandResponse", // Notice there is no messageType
"requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"version": 1
}
}
{
"body": {
"statusMessage": "", // Indicates what the error is
"statusCode": -2147483647 // Indicates the error type
},
"header": {
"messagePurpose": "error", // Notice there is no messageType
"requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"version": 1
}
}
{
"body": {
"eventName": "name-of-event", // The name of the event being responded to
"measurements": null, // No idea what this does...
"properties": { // Additional details about the event and client
}
},
"header": {
"messagePurpose": "event", // Notice there is no messageType
"requestId": "00000000-0000-0000-0000-000000000000", // UUID always seems to be all zeros
"version": 1
}
}
// To see a list of known event names, look at: https://gist.github.com/jocopa3/5f718f4198f1ea91a37e3a9da468675c
{
"body": {
"eventName": "NameOfEvent" // Event to subscribe to
},
"header": {
"requestId": "xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxx",
"messagePurpose": "subscribe", // Notice that messagePurpose is different from messageType
"version": 1,
"messageType": "commandRequest"
}
}
// To see a list of known event names, look at: https://gist.github.com/jocopa3/5f718f4198f1ea91a37e3a9da468675c
{
"body": {
"eventName": "NameOfEvent" // Event to unsubscribe to
},
"header": {
"requestId": "xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxx",
"messagePurpose": "unsubscribe", // Notice that messagePurpose is different from messageType
"version": 1,
"messageType": "commandRequest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment