MetaApi supports the REST API and WebSocket API (socket.io) for communicating with the client.
Each request to the WebSocket API assumes emitting of the
request event on the client side with the necessary parameters.
The application listens for the request event and when it receives a message, it starts to execute it.
The result of the execution will be sent by emitting a
synchronization event depending on the request:
- event name
responseis designed to respond to regular requests
- event name
synchronizationis intended for reporting terminal state changes on the MetaApi side and synchronizing it with your application
One of the problems for communicating applications via WebSocket is matching request-response pairs.
For this purpose, each of the requests must contain the required unique
response event, the same requestId will be returned. Such a mechanism makes it easy to identify request-response pairs in your application.
Terminal state synchronization#
MetaApi allows the client application to subscribe to terminal state change events.
Each time the terminal state changes, MetaApi will emit a
synchronization event, which will carry
information about thу change. See Using streaming API for more information.
Where can I see more details?#
For more information see AsyncApi documentation. The AsyncApi documentation is specifically designed to describe asynchronous requests, which may help to better understand the application toolkit for WebSocket API.