Menu

Astro RPC JSON message format

We used the JSON RPC message format as a guide.

The format of a request and response differ slightly. They both contain an 'id' header, which is the same for the request and the response. It is used to match a response to it's request.

Request

Headers:

Payload:

{
    "senderAddress": <string: Requester Address>",
    "id": <integer: callID>,
    "payload": {
        "method": "<string: Method Name>",
        "params": {
            "parameterName": "parameterValue"
        }
    }
}

Response

Headers:

Payload:

{
    "senderAddress": <string: responderAddress>,
    "id": <Integer callID>,
    "payload": {
        "result": <primitive or object>,
        "error": false
    }
}

or in the case of an error:

{
    "senderAddress": <string: responderAddress>,
    "id": <<Integer callID>,
    "payload" {
        "result": {},
        "error": {
            "message": <string: error message>
        }
    }
}