I’m facing an issue with v3 websocket, could anyone please check? user id - 176522.
Does upstox browser login count towards active websocket connection?
Java error - Market feed socket closed, statusCode : 1002, reason Invalid status code received: 403 Status line: HTTP/1.1 403 Forbidden
Hi @amol
The new WebSocket V3 permits only one connection per access token. Please ensure that you are maintaining a single connection.
If multiple connections are detected, you will receive a 403 Forbidden status.
We have also reviewed the logs and found that you successfully established a connection to the v3 WebSocket around 9:32 AM. However, all subsequent connection attempts failed with a 403 error.
Nope, upstox browser login is not counted as a websocket connection.
Thank you!
I’m doing some changes in the code and since restarting the algo app. How can I close existing connection to open another one or is there way to access existing connection upon restart?
Hi @Ketan
Any update on above query?
If you properly restart the app, the WebSocket connection should be closed from the server’s end.
However, if the connection remains open even after a restart, you can manually close it from your local machine, as a WebSocket connection operates over TCP.
For example, if you are using a macOS laptop, you can follow these steps in the terminal:
- Run
nslookup wsfeeder-api.upstox.com
to retrieve a list of server IP addresses. - Run
netstat -an | grep ESTABLISHED
to display a list of active TCP connections. Identify and copy the IP address of the Upstox server you have connected to via websocket. - Run
lsof -i :<server_port_number> | grep <server_ip_address>
to obtain the process ID associated with the WebSocket connection. - Run
kill -9 <process_id>
to forcefully terminate the WebSocket connection.
A similar approach can be used for different operating systems.
Thanks!
Found the issue in my code. I was trying to reconnect to websocket while being connected hence was getting the error. Websocket connection is working as expected.
Thank you @Ketan.
Thanks @amol for your confirmation