Need Help Resolving WebSocket Error While Running Script

Hi everyone,

I was following a YouTube video tutorial and encountered an issue while running my script. I’m using the Dhan API for my project, but I keep getting repeated errors like:

  • Disconnected: Invalid Client ID
  • WebSocket connection error: no close frame received or sent
  • Reconnecting Again

The script reconnects automatically but keeps failing after a while. I’ve attached a screenshot for reference.

Here’s what I’ve done so far:

  • Confirmed that my Client ID is correctly configured.
  • Verified that my API keys are valid.
  • Tried restarting the system, but the issue persists.

If anyone has encountered this issue or knows how to solve it, your help would be greatly appreciated!
@Tradehull_Imran

Hi @sammed_patil

do check this solution link : Learn Algo Trading with Python | Codes | Youtube Series - #952 by Tradehull_Imran