Skip to main content

6.1 Connection Messages

Available message types:

6.1.1 sync: client initialised

Reception of this message delineates the end of the initial state transfer from the MollyBet servers to the client.

Fields:

token [ string ]

The token of the current session.

Example:

{
"token": "g8dsmnslx17pvsb3ufgy5zqyapwjvpdw"
}

6.1.2 response: websocket command completed

The outcome of the last command sent to the websocket. The content of the message depends on the command sent: see Asynchronous Client Message Types.

Note that there is a strong guarantee that this message will be received after the end of the requested operation. For instance, registering to an event will first transfer all the pre-existing offers to your client before sending the corresponding response message.

Fields:

status [ string ]

The status of the command: ok or error.

code [ string ]

A code for the error; only sent in case the last command failed.

data [ any ]

Response data, whose type and content are specific to each request.

Example:

{
"status": "ok",
"data": {
"registered_events": [
["tennis", "2016-11-02,64630,64456"],
["fb", "2016-11-02,27702,27716"]
]
}

{
"status": "error",
"code": "invalid_event"
}

6.1.3 info: stream connection information

Sent periodically with miscellaneous information about the current websocket connection.

Fields:

queue_size [ int ]

This indicates how slow the client is to read data from the server. Lower numbers are better. If this number grows too large you may be disconnected.

registered_events [ int ]

The total number of events currently registered for updates over this particular connection. The complete list of events may be requested using the list_registered_events call. This can be useful for managing your group register_event limits.

max_queue_size [ int ]

The maximum size (capacity) of the server internal queue for async messages still waiting to be transmitted. This is a constant. If the number of queued messages exceeds this values, the server closes the connection, on the theory that the client is a slow reader and with so many messages in the queue it means that messages must be arriving to client with so much delay that they are no longer useful.

queue_size_max [ int ]

This reports the maximum value observed, since the connection was established, of the queue (used) size.

Example:

{
"queue_size": 5,
"registered_events": 87,
"max_queue_size": 32768,
"queue_size_max": 1150,
}

6.1.4 connection_closed: client is being disconnected

The connection is being closed by the server. It has no content.