Status#
About#
Notifies of terminal broker connection status.
For more information see AsyncApi documentation
Description#
This event is emitted by MetaApi periodically for deployed accounts.
The message below can be received from the synchronization
event.
Name | Type | Required | Description |
---|---|---|---|
type | string | Yes | The value of this field will be status |
connected | boolean | Yes | If true, it means that the terminal is connected to a broker |
authenticated | boolean | Yes | If true, it means that the terminal is initialized and can process incoming requests |
accountId | string | Yes | account id specified in the request |
healthStatus | object | Yes | server-side application health status |
host | string | Yes | Hostname the event was generated at |
healthStatus fields#
Name | Type | Required | Description |
---|---|---|---|
rpcApiHealthy | boolean | Yes | flag indicating that RPC API is healthy |
copyFactorySubscriberHealthy | boolean | flag indicating that CopyFactory subscriber is healthy | |
copyFactoryProviderHealthy | boolean | flag indicating that CopyFactory provider is healthy |
Code example:
import ioClient from 'socket.io-client';
const socket = ioClient('https://mt-client-api-v1.agiliumtrade.agiliumtrade.ai', {
path: '/ws',
reconnection: false,
query: {
'auth-token': 'token'
}
});
const request = {
accountId: '865d3a4d-3803-486d-bdf3-a85679d9fad2',
type: 'synchronize',
requestId: '57bfbc9f-108d-4131-a300-5f7d9e69c11b',
startingDealTime: '2019-01-13T10:29:26.000Z',
startingHistoryOrderTime: '2019-01-13T10:29:26.000Z'
};
socket.on('connect', () => {
socket.emit('request', request);
});
socket.on('synchronization', data => {
console.log(data);
if (data.type === 'authenticated') {
request.requestId = uuid.v4();
socket.emit('request', request);
}
});
socket.on('processingError', err => {
console.error(err);
});
An example of a synchronization payload:
{
"type": "status",
"connected": true,
"authenticated": true,
"accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2",
"host": "ps-mpa-1"
}