Websocket not working only on my account!

I am unable to use my WEBSOCKET since last week, earlier it was working perfectly.

async with websockets.connect(response.data.authorized_redirect_uri, ssl=ssl_context) as websocket:
File “/opt/homebrew/lib/python3.10/site-packages/websockets/legacy/client.py”, line 629, in aenter
return await self
File “/opt/homebrew/lib/python3.10/site-packages/websockets/legacy/client.py”, line 647, in await_impl_timeout
return await self.await_impl()
File “/opt/homebrew/lib/python3.10/site-packages/websockets/legacy/client.py”, line 654, in await_impl
await protocol.handshake(
File “/opt/homebrew/lib/python3.10/site-packages/websockets/legacy/client.py”, line 325, in handshake
raise InvalidStatusCode(status_code, response_headers)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 403

The auth token is correct and also the code is perfectly working on my friend’s auth token.

Seems like upstox have blocked my account for websocket usage or something.

@Sambhrant,

The 403 issue you are encountering is likely due to an invalid single-use code in your authorized_redirect_uri. Please note that the authorized_redirect_uri generated is valid for a single use only.

I suggest utilizing the SDK to establish a WebSocket connection. You can try the Python SDK provided here: Upstox Python SDK. Detailed instructions on using the WebSocket are available in the README file on the repository page.

Thank you!

I think it was something from your end, it is now fixed on it’s own my account is now working.