Skip to content

Terminal API

Eugene V. Palchukovsky edited this page Dec 15, 2018 · 13 revisions

General

API uses a WebSocket connection to communicate by messages in JSON-format. Each message is an array with one or more messages, where each message has the next format:

{
  "topic": string with the message topic
  "data": message data, format depends on message topic
}

Workflow

The first message from a newly connected client to the service must be a message with the authorization request. Any other messages may be sent only after successful authorization. If the service will receive any message before - the client connection will be terminated.

Messages

Authorization

The message has topic auth. Client message provides accounts credentials to requests the authorization process for the connection. The service message reports about authorization status. If the authorization process will be failed for any reason - service will close client connection.

Request

{
  "topic": "auth",
  "data": {
    "login": `string with user login`,
    "password": string with user password
  }
}

Response

{
  "topic": "auth",
  "data": {
    "success": true, if the connection is authenticated, or false if not
  }
}

Example

Request:

[ { "topic": "auth", "data": { "login": "guest", "password": "Qwerty123" } } ]

Response:

[ { "topic": "auth", "data": { "success": true } } ]

Clone this wiki locally