Messages
See Connecting for how they fit together.
From the client
Section titled “From the client”{ "id": 1, "method": "tokens.get", "params": { ... } }| Key | Description |
|---|---|
id |
A number or a string. Names the reply, and the subscription if the method makes one |
method |
The method to call |
params |
The method’s params. Can be left out when there are none |
From the server
Section titled “From the server”Every message also has credits_used, see Credits.
| Message | When |
|---|---|
{ "hello": { "version": 2, "height", "timestamp_millis", "limits" } } |
First, once |
{ "id": 1, "result": { ... } } |
The reply to request 1 |
{ "id": 1, "error": { "code", "message" } } |
Request 1 failed. A subscription it would have made doesn’t exist |
{ "sub": 1, "height", "timestamp_millis", ... } |
A push of the subscription request 1 made |
{ "sub": 1, "end": { "code", "message" } } |
The server ended subscription 1 |
{ "idle": { "height", "timestamp_millis" } } |
After 15 seconds with nothing else sent |
Closing codes
Section titled “Closing codes”| Code | Why |
|---|---|
1008 |
The client sent a binary message, or one that isn’t a JSON object with an id and a method |
1009 |
The client sent a message over 64 KiB |
unsubscribe
Section titled “unsubscribe”Ends a subscription, so its id can be used again.
| Param | Description |
|---|---|
sub |
Required. The subscription’s id |
The result is {}.
schema
Section titled “schema”Takes no params. HTTP: /schema. The result describes the whole API, for checking a client against and generating types from:
token_fields: every token field with its type, and whether it works inwhere,sortandmin_change;windows,thresholds,intervals_msandlimits;trade_fields,transfer_fieldsandtransaction_fields;methods: every method’s params, and its HTTP path if it has one.