API Basics

Standardized format and requirements for all communications.

Client requests

⚠️ Subject to change.

This metadata must be provided in each frontend-to-server transmission.

⭕ All requests from the frontend to the server must contain at most one action.

{
    "request_id": <int>,
    // Request
}
  • session: Required when joining a session. Not required when creating a new session.
  • request_id: Requests may be processed out of order because of multithreading. If the client requires a request to be executed in order, he must wait for a success response, before submitting the next.

Server responses

⚠️ Subject to change.

The server must provide a response for each request. It indicates if the request is a success, failure, or other. These responses are analogous to HTTP reponses.

{
    "message_type": "respond",
    "respond_id": <int>,
    "status_code": <int>,
    "status_message": <string>,
    // Respond
}

Server broadcasts

⚠️ Subject to change.

The server may broadcast a message to all clients. All client must actively listen to a broadcast.

{
    "message_type": "broadcast",
    // Broadcast
}