Explorer Handler - Messages

Basics

This handler is used for explorer (robot) configuration and administrative messages (e.g. on error) while communicating or after solving a task. For each login, there is a specific topic the account has access permissions to.

Correct topics:

explorer/<ID>
explorer-dev/<ID>

Message Types

Generic (sent by other handlers)

Error Response:

Field message is always a string and one of the following items from the (examples) list in the code snippet

{
  "from": "debug",
  "type": "error",
  "payload": {
    "message": [
      "JSON was invalid: <ERROR>",
      "Payload is missing",
      "Explorer is not configured",
      "Planet mismatch (is vs. should): <CURR_PLANET> vs. <SHOULD_PLANET>"
    ],
    "debug": ""
  }
}

Type testPlanet

Request:

{
  "from": "client",
  "type": "testPlanet",
  "payload": {
    "planetName": "<PLANET>"
  }
}

Response:

{
  "from": "debug",
  "type": "notice",
  "payload": {
    "message": "Test planet set to <PLANET>"
  }
}

Error Response:

Field message is always a string and one of the following items from the (examples) list in the code snippet

{
  "from": "debug",
  "type": "error",
  "payload": {
    "message": [
      "Payload is missing",
      "Setting testPlanet not permitted in exam mode",
      "Planet <PLANET> does not exist"
    ],
    "debug": ""
  }
}

Type ready

Request:

{
  "from": "client",
  "type": "ready"
}

Response:

{
  "from": "server",
  "type": "planet",
  "payload": {
    "planetName": "<PLANET_NAME>",
    "startX": 0,
    "startY": 0,
    "startOrientation": 0
  }
}

Type targetReached

Request:

{
  "from": "client",
  "type": "targetReached",
  "payload": {
    "message": "<MESSAGE>"
  }
}

Response:

{
  "from": "server",
  "type": "done",
  "payload": {
    "message": "Target reached - Well done!"
  }
}

Error Response:

Field message is always a string and one of the following items from the (examples) list in the code snippet

{
  "from": "debug",
  "type": "error",
  "payload": {
    "message": [
      "Explorer is not configured",
      "No planet has been set",
      "No target has been set",
      "No point yet visited",
      "Target not reached yet"
    ],
    "debug": ""
  }
}

Type explorationCompleted

Request:

{
  "from": "client",
  "type": "explorationCompleted",
  "payload": {
    "message": "<MESSAGE>"
  }
}

Response:

{
  "from": "server",
  "type": "done",
  "payload": {
    "message": "Exploration completed - Well done!"
  }
}

Error Response:

Field message is always a string and one of the following items from the (examples) list in the code snippet

{
  "from": "debug",
  "type": "error",
  "payload": {
    "message": [
      "Explorer is not configured",
      "No planet has been set",
      "There is a reachable target set",
      "Not all paths or nodes explored yet"
    ],
    "debug": ""
  }
}