metaapi / metaapi-javascript-sdk

Browser and node.js javascript SDK for MetaApi, a professional cloud forex trading API for MetaTrader platform which supports both MetaTrader MetaTrader 5 and MetaTrader 4. Free usage tier available.
https://metaapi.cloud
Other
25 stars 1 forks source link

Failed to subscribe TimeoutError #2

Closed kram-capital closed 8 months ago

kram-capital commented 9 months ago

I am initiating a websocket connection using the code in /examples/node/mt5/mt5.real-time-streaming.js

I have modified the script to leave the connection open and it does indeed populate the bin files in ./.metaapi

I do keep getting an error. I have confirmed that the server is running in the cloud console, I have added redundancy as an extra measure but the error prevails. I have added a health check for the debug

Waiting for SDK to synchronize to terminal state (may take some time depending on your history size) [2023-12-13T09:47:47.241Z] Connecting MetaApi websocket client to the MetaApi server via https://mt-client-api-v1.london-a.agiliumtrade.ai shared server. [2023-12-13T09:47:47.241Z] Connecting MetaApi websocket client to the MetaApi server via https://mt-client-api-v1.london-b.agiliumtrade.ai shared server. [2023-12-13T09:47:47.242Z] Connecting MetaApi websocket client to the MetaApi server via https://mt-client-api-v1.new-york-a.agiliumtrade.ai shared server. [2023-12-13T09:47:47.242Z] Connecting MetaApi websocket client to the MetaApi server via https://mt-client-api-v1.new-york-b.agiliumtrade.ai shared server. [2023-12-13T09:47:47.447Z] london:0: MetaApi websocket client connected to the MetaApi server [2023-12-13T09:47:47.809Z] new-york:0: MetaApi websocket client connected to the MetaApi server [2023-12-13T09:47:47.850Z] new-york:1: MetaApi websocket client connected to the MetaApi server [2023-12-13T09:47:49.073Z] london:1: MetaApi websocket client connected to the MetaApi server connected: true Leaving the connection open to test for socket messages {} { connected: true, connectedToBroker: true, quoteStreamingHealthy: undefined, synchronized: true, healthy: undefined, message: 'Connection is not healthy because quotes are not streamed from the broker properly.' } { '5m': 0, '1h': 0, '1d': 0, '1w': 0 } [2023-12-13T09:47:54.171Z] instance-id: Failed to subscribe TimeoutError: It seems like the account instance-id is not connected to broker yet or SDK settings you use does not match the account region. Please make sure account is connected to broker before retrying the request. Please make sure you pass a region option to MetaApi constructor for Java SDK. Please make sure you do not pass region option to MetaApi constructor for javascript and python SDKs. at MetaApiWebsocketClient._convertError (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\metaapi.cloud-sdk\dist\clients\metaApi\metaApiWebsocket.client.js:1432:20) at Socket. (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\metaapi.cloud-sdk\dist\clients\metaApi\metaApiWebsocket.client.js:357:40) at Emitter.emit (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\component-emitter\index.js:145:20) at Socket.onevent (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\metaapi.cloud-sdk\node_modules\socket.io-client\lib\socket.js:278:10) at Socket.onpacket (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\metaapi.cloud-sdk\node_modules\socket.io-client\lib\socket.js:236:12) at Manager. (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\component-bind\index.js:21:15) at Emitter.emit (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\component-emitter\index.js:145:20) at Manager.ondecoded (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\metaapi.cloud-sdk\node_modules\socket.io-client\lib\manager.js:349:8) at Decoder. (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\component-bind\index.js:21:15) at Emitter.emit (C:\Users\markb\Code\metaapi-javascript-sdk\examples\node\node_modules\component-emitter\index.js:145:20)

metaapi commented 8 months ago

Hello, the error likely means that your trading account is not connected to a broker at this point. Please make sure that your trading account is deployed and connected to broker.

Closing because this is not an SDK bug.