Error 400 and 401

It connects and subscribes successfully, and then it breaks resulting in the above mentioned errors
2025-02-11 01:39:42,293 - DEBUG - = connection is OPEN
2025-02-11 01:39:42,295 - DEBUG - < TEXT ‘[{“T”:“success”,“msg”:“connected”}]’ [35 bytes]
2025-02-11 01:39:42,298 - INFO - WebSocket authentication sent.
2025-02-11 01:39:42,299 - DEBUG - Authentication response: [{‘T’: ‘success’, ‘msg’: ‘connected’}]
2025-02-11 01:39:42,301 - INFO - Authentication successful.
2025-02-11 01:39:42,302 - DEBUG - Sending subscription data: {“action”: “subscribe”, “bars”: [““]}
2025-02-11 01:39:42,304 - DEBUG - > TEXT '{“action”: “subscribe”, “bars”: [”
”]}’ [38 bytes]
2025-02-11 01:39:42,305 - INFO - Subscribed to stock channels.
2025-02-11 01:39:42,329 - DEBUG - < TEXT ‘[{“T”:“error”,“code”:400,“msg”:“invalid syntax”}]’ [49 bytes]
2025-02-11 01:39:42,330 - DEBUG - Received WebSocket data: [{‘T’: ‘error’, ‘code’: 400, ‘msg’: ‘invalid syntax’}]
2025-02-11 01:39:42,361 - DEBUG - < TEXT ‘[{“T”:“error”,“code”:401,“msg”:“not authenticated”}]’ [52 bytes]
2025-02-11 01:39:42,363 - DEBUG - Received WebSocket data: [{‘T’: ‘error’, ‘code’: 401, ‘msg’: ‘not authenticated’}]

Hey :wave:

You have two issues:

  1. In your subscribe message you try to subscribe to an empty symbol ([""]), that causes the “invalid syntax” error.
  2. You don’t send an authentication message, that’s why you get the “not authenticated” error.