Skip to main content

WebSocket API

The ALOR Broker trading system supports communication via the WebSocket protocol, providing access to resources via WebSocket APIs.

This interaction method has the following advantages over the HTTP API:

  • Continuous connection: While the HTTP API terminates the client-server connection after each processed request, the WebSocket connection remains active, enabling continued communication between server and client.
  • Bidirectional Data Exchange: Within an established connection, the client and server can continue to exchange data bidirectionally while maintaining the state of that exchange.
  • Asynchronous Data Exchange: The HTTP API returns a one response per request. The WebSocket API allows multiple messages to be received from the server as a response to a single request.
  • Real-time data exchange: WebSocket API allows you to receive updated data as soon as it changes in the system without having to query it manually.

However, this method of interaction also has a disadvantage:

  • Single message stream: A single WebSocket connection may contain responses to several separate requests, so the mechanism of sorting and filtering them may differ from the HTTP API.

WebSocket API is ok to use when:

  • It is needed to receive promptly dynamic data about securities important for trading (like order book or quotes);
  • Trades have high intensity and it is required to perform a large number of operations in a short time.

For all other cases, we recommend considering using the HTTP API resources.

caution

Disruptive actions may result in the user being temporarily blocked regardless of the connection protocol chosen. We recommend, among other things, reading the fair-use guidelines, which we expect all API users to follow.