Description
When attempting to establish a WebSocket connection using the MetaApi Python SDK, I encountered a recurring error during the initial handshake process. The error message is:
OPEN packet not returned by server
This error is thrown by the underlying Engine.IO client (specifically during the polling transport phase) and prevents the connection from being successfully established. The error appears repeatedly when trying to connect to multiple MetaApi endpoints (e.g., https://mt-client-api-v1.london-a.agiliumtrade.ai and https://mt-client-api-v1.london-b.agiliumtrade.ai).
The issue occurs during the initial handshake—before any broker-specific actions are taken—indicating that the expected handshake (OPEN) packet from the server is not being received. This suggests the problem might lie with the MetaApi server or its compatibility with the current SDK/Engine.IO version.
Here's more of the error code:
raise exceptions.ConnectionError(\nengineio.exceptions.ConnectionError: OPEN packet not returned by server\n"}
[2025-02-05T08:29:38.493015] Connecting MetaApi websocket client to the MetaApi server via https://mt-client-api-v1.london-a.agiliumtrade.ai shared server.
[2025-02-05T08:29:38.504624] london:1: MetaApi websocket client connection error {"name": "str", "message": "OPEN packet not returned by server", "trace": "Traceback (most recent call last):\n File \"/Users/locus/miniforge3/envs/py311/lib/python3.11/site-packages/socketio/async_client.py\", line 149, in connect\n await self.eio.connect(real_url, headers=real_headers,\n File \"/Users/locus/miniforge3/envs/py311/lib/python3.11/site-packages/engineio/async_client.py\", line 130, in connect\n return await getattr(self, '_connect_' + self.transports[0])