Got the wss url using the following:
Portfolio Stream Feed Authorize Url | Upstox Developer API
Once I connected to wss url, it was working fine (
till yesterday) without any additional authentication headers (on wss websocket request)
Today, all of a sudden I am getting unauthorized error, see screenshot below:
The url generated to connect to the websocket is valid for one time use as the
code param present in the URI is for single-use. Please generate a new URL to reconnect to the websocket. We’ll explicitly mention this in the documentation.
On the contrary, using the
Market Feeder Auto Redirect Endpoint should take care of the auth and re-connect automatically.
I am regenerating the url, so I looked further into it.
My connection is established & later disconnected with following error message. This message comes when I send a ping. My pings are a simple text message with word
WS connection closed. Status [CloseStatus[code=1003, reason=Client messages not supported]]
So, it seems this is the cause. Please give me the exact format of the heartbeat message.
Please refer to the following response:
Our WebSocket server sends out ping events, expecting a corresponding pong response. Most WebSocket clients across various programming languages handle this automatically. If you choose to customize the default behavior, you should ensure your client listens for pings and sends back pongs accordingly.
We accept any general payload with the pong response and do not require a specific format.
@shanmu Please close the ticket.