Websockets - sociam/indx GitHub Wiki

Basics

Each websocket frame is a JSON string, and is either a new request or a response to an existing request.

Each frame must has the following required fields:

  • requestid - This is a UUID generated by the client, the response will contain the same requestid, and is used to match response to request.
  • action - A string of the action this request wishes to perform, see below.

Other optional shared fields are:

  • operation - A specific operation that this action will handle.
  • respond_to - Specifies the action that this frame is in response to, present on every response.
  • token - An authentication token that has been assigned by the server.

Tokens

Some (most) requests require a token to be specified. This token must be authenticated using an auth request once per websocket, before any requests can use it, in order for it to work.

Actions

  • http - Wrap an HTTP call in the websocket, see Websockets/HTTP.

  • diff - Requests to start/stop/modify a diff stream, see Websockets/Diff.

  • echo - Test call to receive back an exact echo of the request, see Websockets/Echo.

  • auth - Authorise the specified token over this websocket, see Websockets/Auth.

  • login_keys - Login to a box using keys (primarily used server-to-server), see Websockets/LoginKeys.

  • response - Used to signify this is a response from a client to a server, see Websockets/Response.