# Errors and Debugging
Important: Matcher WebSocket API documentation provides information about most common errors that can appear during streams. However, the provided information might not cover all possible cases. You might get other standardized errors. If you come across such errors, please contact support or developers team. Please also note that the Server tries hard, but can not guarantee the delivery of all the errors to the Client.
See list of all possible errors (opens new window).
# Handshake Errors
Errors can occur during handshake. The cause of such errors is described in the reply HTTP-header:
X-Error-Code - error code; X-Error-Message - error message;
The error codes and messages are similar to the corresponding fields of JSON objects that describe the errors returned by HTTP Matcher API: https://github.com/wavesplatform/matcher/wiki/List-of-all-errors-(future-release)
# Operation Errors
Errors can occur during operation. Such errors contain standardized (opens new window) code and message and are received from server as system messages. Such errors cause the connection to close.
Error example:
{
"T": "e",
"_": 1585148910776,
"c": 8388624,
"m": "The order book for Emn8cyGDFgnLCKLTXqVWhKJARhtR2muBUuZaSmqNzDfn-Co11Tbj83TeZCnuXrZQwv6Bs4XG2sm1vGQiQ4FLDjJWs is stopped, please contact with the administrator"
}
In this example:
e is the type of message that stands for "error".
1585148910776 is Unix timestamp of error in milliseconds. This field is only for debugging.
8388624 is the error code.
m field contains the error description message.
# Other General Errors
General errors can occur during any type of stream.
MatcherIsStopping
- the Server is in the process of shutdown. Such errors usually occur during updating. It is recommended to reconnect;
PongTimeout
- the Client failed to reply to Ping
request. Such error can be cause by bad connection on the Client side. It is recommended to fix connection issues and reconnect;
UnexpectedError
- system error. Please contact support team;
# Debugging Network Connection
In some cases you may need to debug the connection on the Client or on the Server side. You need the attribute that will filter records of the logs on both sides. When opening connection Matcher sends to the Client a special message with such attribute in the "i" field.
If there is a problem, please send the value of the attribute to support or developers team. Also, send to support or developers team the requests with timestamps sent via WebSocket from the Client side. This will help to diagnose of the problem.
Example:
{
"T": "i",
"_": 1585148910776,
"i": "736fe9b1-59ad-4164-a942-c07a081678d5"
}
In this example:
i is the message type, that stands for initial/information.
1585148910776 is Unix timestamp of update in milliseconds. This field is only for debugging.
736fe9b1-59ad-4164-a942-c07a081678d5 is the connection id.
# Detecting Network Problems on the Client Side
TCP/IP that WebSocket is based on tries hard, but there is no guarantee that 100% of messages are delivered. To solve this problem Matcher sends update id with every domain message.
The field update id:
is incremental. So that, every next value is one more than the previous one;
starts count from 0, that comes with the snapshot of the domain entity;
has the last value 9007199254740991. After this value the count resets to 1;
is encoded by letter U;
has own value at every connection;
Example:
{
"U": 1025 // update id
}
In this example:
1025 is the update id
The Client should watch for the update id, close and open connection again if one of the conditions is not fulfilled:
the first domain message has update id = 0
every next message has the update id = previous(update id) + 1
when the last value is achieved, the next one should = 1
Note: Ignoring this recommendations may lead to inconsistency of the entity.
# FAQ
Q: Why 9007199254740991?
A: This value is the constant Number.MAX_SAFE_INTEGER in browsers. Please note that currently the max connection time is 24 hours, so the last value of the counter is unreachable.