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
30 stars 3 forks source link

Transport Error #1

Closed gemlabsdev closed 10 months ago

gemlabsdev commented 10 months ago

Hi, occasionally I get this transport error on the console.

2023-11-21T05:58:56.611218+00:00 app[web.1]: [2023-11-21T05:58:56.611Z] new-york:0: MetaApi websocket client disconnected from the MetaApi server because of transport close 2023-11-21T05:58:57.427599+00:00 app[web.1]: [2023-11-21T05:58:57.425Z] new-york:0: MetaApi websocket client connection error Error: xhr poll error 2023-11-21T05:58:57.427612+00:00 app[web.1]: at Transport.onError (/app/node_modules/engine.io-client/lib/transport.js:68:13) 2023-11-21T05:58:57.427612+00:00 app[web.1]: at Request. (/app/node_modules/engine.io-client/lib/transports/polling-xhr.js:132:10) 2023-11-21T05:58:57.427613+00:00 app[web.1]: at Emitter.emit (/app/node_modules/component-emitter/index.js:145:20) 2023-11-21T05:58:57.427613+00:00 app[web.1]: at Request.onError (/app/node_modules/engine.io-client/lib/transports/polling-xhr.js:314:8) 2023-11-21T05:58:57.427613+00:00 app[web.1]: at Timeout._onTimeout (/app/node_modules/engine.io-client/lib/transports/polling-xhr.js:261:18) 2023-11-21T05:58:57.427614+00:00 app[web.1]: at listOnTimeout (node:internal/timers:573:17) 2023-11-21T05:58:57.427614+00:00 app[web.1]: at process.processTimers (node:internal/timers:514:7) { 2023-11-21T05:58:57.427615+00:00 app[web.1]: type: 'TransportError', 2023-11-21T05:58:57.427616+00:00 app[web.1]: description: 502 2023-11-21T05:58:57.427616+00:00 app[web.1]: }

Obviously the request fails, however all subsequent requests seem to work fine until we reach another failure. Do you have any idea what might be causing this?

metaapi commented 10 months ago

Please share the log lines preceding the error which contain the URL your application connects to.

metaapi commented 10 months ago

Closing the ticked due to no response. Feel free to send a follow-up message if this issue is still actual.

gemlabsdev commented 10 months ago

Hi, I apologize for the late response. It turns our that the issue had been caused by a hanging open connection if two or more concurrent calls were made though my server application. I implemented a priority queue to handle all requests on my server and haven't run into any Transport Errors since.