Webcoket connection not allowing more than 3

Hi, I am upstox proplus user, I should be able to establish 5 websocket connection but its allowing only 3, I am subscribing Full category, please guide, below is the log
@Anand_Sajankar @Ketan @Ketan_Gupta

:bar_chart: Instrument Selection Summary:
2025-09-17 13:31:15,439 - MainThread - INFO - Total selected for subscription: 7890
2025-09-17 13:31:15,448 - MainThread - INFO -
— Starting 5 WebSocket worker(s) —

2025-09-17 13:31:15,600 - WebSocket-Chunk-1 - INFO - [WebSocket-Chunk-1] Connecting to WebSocket at: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=9b9e377d-1004-46ee-91ce-25e8512772d0&code=QopU0-2a1c757d-3c2b-4d05-a204-a75d0c1c9b37
2025-09-17 13:31:15,739 - WebSocket-Chunk-1 - INFO - :white_check_mark: [WebSocket-Chunk-1] WebSocket connection established.
2025-09-17 13:31:15,741 - WebSocket-Chunk-1 - INFO - :white_check_mark: [WebSocket-Chunk-1] Subscription request sent for 1579 instruments.
2025-09-17 13:31:17,613 - WebSocket-Chunk-2 - INFO - [WebSocket-Chunk-2] Connecting to WebSocket at: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=3c6119d2-2314-4677-b6ae-3a76309b8deb&code=Oy3HQ-0f010352-6123-46bd-aff4-c9ae407976e5
2025-09-17 13:31:17,706 - WebSocket-Chunk-2 - INFO - :white_check_mark: [WebSocket-Chunk-2] WebSocket connection established.
2025-09-17 13:31:17,707 - WebSocket-Chunk-2 - INFO - :white_check_mark: [WebSocket-Chunk-2] Subscription request sent for 1579 instruments.
2025-09-17 13:31:19,615 - WebSocket-Chunk-3 - INFO - [WebSocket-Chunk-3] Connecting to WebSocket at: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=62dfa001-9eb7-4eed-9ef7-3d6602a58585&code=fKprk-185df185-15cd-4ade-abaa-9bb338b7f058
2025-09-17 13:31:19,703 - WebSocket-Chunk-3 - INFO - :white_check_mark: [WebSocket-Chunk-3] WebSocket connection established.
2025-09-17 13:31:19,708 - WebSocket-Chunk-3 - INFO - :white_check_mark: [WebSocket-Chunk-3] Subscription request sent for 1579 instruments.
2025-09-17 13:31:21,828 - WebSocket-Chunk-4 - INFO - [WebSocket-Chunk-4] Connecting to WebSocket at: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=8c464ef3-4a2d-494b-8773-263d518392f0&code=DjeM8-0677491b-fba9-4540-aed7-49c41087220d
2025-09-17 13:31:21,945 - WebSocket-Chunk-4 - ERROR - :police_car_light: [WebSocket-Chunk-4] WebSocket connection rejected with status 403, server rejected WebSocket connection: HTTP 403, This could be due to an expired token. Retrying in 30s.
2025-09-17 13:31:23,706 - WebSocket-Chunk-5 - INFO - [WebSocket-Chunk-5] Connecting to WebSocket at: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=188e1de0-53ec-4e49-bca9-60b043899bec&code=KpaZT-c5253cd5-9a2b-4d25-9ced-944aa8644fd9
2025-09-17 13:31:23,801 - WebSocket-Chunk-5 - ERROR - :police_car_light: [WebSocket-Chunk-5] WebSocket connection rejected with status 403, server rejected WebSocket connection: HTTP 403, This could be due to an expired token. Retrying in 30s.

here is the code https://sharetext.io/46acd81f
please guide

@Ushnota I am stuck because of the above issue. It has been more than 14 days and I haven’t received any reply. Can you please help me resolve this?

Hi @RAM_KRISHN_1864028

There could be a case in your implementation where multiple connections are being created without your awareness. For easier WebSocket implementation, you can refer to the streamer functionalities available in the different SDKs:

You should be able to connect up to 5 simultaneous connections to the Market Feeder v3. Could you please share your user ID so we can investigate further if not able to connect to 5 connections?

Sir same issue with me not allowing more than 1 few mins back i was using 3 more connection but suddenly its not happening

My userid is AB8793, I have used this version upstox-python/examples/websocket/market_data/v3 at master · upstox/upstox-python · GitHub , is the streamer functionalities different that the one I am using ?

@Ketan can you please look into and suggest?

@Ushnota could you please get it checked ? let me know if your team need more info

Hi
I checked for your user ID and found that your last connection was on 23rd September. No new authorized connection requests have been sent to the Market Feeder V3 since then.

On that day, our logs show five successful connections.

Please note that the streamer functions act as a wrapper over the WebSocket and provide additional functionalities such as:

  • Reconnection
  • Subscribe
  • Change mode
  • Unsubscribe

Could you please try again today and let us know if you face any issues?

Thanks!

Thanks, I rechecked my code after upgrading to streamer, here is the log.

(ai-ml-new) ➜ nse-bse-scrapper git:(refactor-upstox-websocket-sdk) ✗ /opt/anaconda3/envs/ai-ml-new/bin/python /Users/om/Documents/workspaces/rnd/nse-bse-scrapper/upstox/upstox_websocket.py
2025-10-09 19:04:39,428 - MainThread - INFO - — Upstox SDK WebSocket Subscriber Service Started —
2025-10-09 19:04:39,428 - MainThread - INFO - Attempting to get a single access token using app: ‘rnd1’
2025-10-09 19:04:39,428 - MainThread - INFO - Requesting token for app ‘rnd1’ using cache file ‘/Users/om/Documents/workspaces/rnd/nse-bse-scrapper/cache/upstox_auth_rnd1.json’
2025-10-09 19:04:39,560 - MainThread - INFO - :white_check_mark: Today’s token is valid. Reusing it.
2025-10-09 19:04:39,561 - MainThread - INFO - :white_check_mark: Successfully obtained a single access token.
2025-10-09 19:04:39,573 - MainThread - INFO - Loading instruments from cache: cache/upstox_nfo_instruments.json
2025-10-09 19:04:39,989 - MainThread - INFO - :memo: List of subscribed trading symbols saved to subscribed_options.log
2025-10-09 19:04:39,989 - MainThread - INFO -
:bar_chart: Instrument Selection Summary: Total selected for subscription: 7890
2025-10-09 19:04:39,998 - MainThread - INFO - Distributing 7890 instruments into 4 chunks of max 1999 each.
2025-10-09 19:04:39,999 - MainThread - INFO -
— Starting 4 WebSocket streamer(s) (capped at 4) —
2025-10-09 19:04:40,007 - RabbitMQ-Publisher - INFO - Pika version 1.3.2 connecting to (‘100.69.32.37’, 5672)
2025-10-09 19:04:40,017 - RabbitMQ-Publisher - INFO - Socket connected: <socket.socket fd=16, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘100.81.211.105’, 52084), raddr=(‘100.69.32.37’, 5672)>
2025-10-09 19:04:40,017 - RabbitMQ-Publisher - INFO - Streaming transport linked up: (<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x1415891b0>, _StreamingProtocolShim: <SelectConnection PROTOCOL transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x1415891b0> params=>).
2025-10-09 19:04:40,042 - RabbitMQ-Publisher - INFO - AMQPConnector - reporting success: <SelectConnection OPEN transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x1415891b0> params=>
2025-10-09 19:04:40,042 - RabbitMQ-Publisher - INFO - AMQPConnectionWorkflow - reporting success: <SelectConnection OPEN transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x1415891b0> params=>
2025-10-09 19:04:40,042 - RabbitMQ-Publisher - INFO - Connection workflow succeeded: <SelectConnection OPEN transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x1415891b0> params=>
2025-10-09 19:04:40,042 - RabbitMQ-Publisher - INFO - Created channel=1
2025-10-09 19:04:40,053 - RabbitMQ-Publisher - INFO - :white_check_mark: [RabbitMQ] Connection established. Exchange ‘angelone-tick-exchange’ is ready.
2025-10-09 19:04:40,258 - Thread-14 (run_forever) - INFO - Websocket connected
2025-10-09 19:04:40,258 - Thread-14 (run_forever) - INFO - :white_check_mark: [Streamer-1] Connection opened. Subscribing to 1999 instruments.
2025-10-09 19:04:40,529 - Thread-14 (run_forever) - INFO - :white_check_mark: Received initial feed confirmation for 1999 instruments.
2025-10-09 19:04:42,465 - Thread-16 (run_forever) - INFO - Websocket connected
2025-10-09 19:04:42,465 - Thread-16 (run_forever) - INFO - :white_check_mark: [Streamer-2] Connection opened. Subscribing to 1999 instruments.
2025-10-09 19:04:42,771 - Thread-16 (run_forever) - INFO - :white_check_mark: Received initial feed confirmation for 1999 instruments.
2025-10-09 19:04:44,450 - Thread-17 (run_forever) - INFO - Websocket connected
2025-10-09 19:04:44,451 - Thread-17 (run_forever) - INFO - :white_check_mark: [Streamer-3] Connection opened. Subscribing to 1999 instruments.
2025-10-09 19:04:44,746 - Thread-17 (run_forever) - INFO - :white_check_mark: Received initial feed confirmation for 1999 instruments.
2025-10-09 19:04:46,258 - Thread-18 (run_forever) - ERROR - :police_car_light: [Streamer-4] An error occurred: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:46 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None
2025-10-09 19:04:46,260 - Thread-18 (run_forever) - ERROR - Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:46 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None - goodbye
2025-10-09 19:04:46,260 - Thread-18 (run_forever) - WARNING - :police_car_light: [Streamer-4] Connection closed. Code: None, Reason: None
2025-10-09 19:04:46,494 - Thread-19 (run_forever) - ERROR - :police_car_light: [Streamer-4] An error occurred: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:46 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None
2025-10-09 19:04:47,503 - Thread-19 (run_forever) - ERROR - Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:46 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None - goodbye
2025-10-09 19:04:47,730 - Thread-20 (run_forever) - ERROR - :police_car_light: [Streamer-4] An error occurred: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:47 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None
2025-10-09 19:04:48,020 - MainThread - INFO -
— All 4 WebSocket connections are running. —
2025-10-09 19:04:48,020 - MainThread - INFO - — Service is now in supervisor mode. Press CTRL+C to shut down. —
2025-10-09 19:04:48,735 - Thread-20 (run_forever) - ERROR - Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:47 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None - goodbye
2025-10-09 19:04:49,093 - Thread-21 (run_forever) - ERROR - :police_car_light: [Streamer-4] An error occurred: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:49 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None
2025-10-09 19:04:50,100 - Thread-21 (run_forever) - ERROR - Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:49 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None - goodbye
2025-10-09 19:04:50,451 - Thread-22 (run_forever) - ERROR - :police_car_light: [Streamer-4] An error occurred: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:50 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None
2025-10-09 19:04:51,459 - Thread-22 (run_forever) - ERROR - Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:50 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None - goodbye
2025-10-09 19:04:51,817 - Thread-23 (run_forever) - ERROR - :police_car_light: [Streamer-4] An error occurred: Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:51 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None
2025-10-09 19:04:51,818 - Thread-23 (run_forever) - ERROR - Handshake status 403 Forbidden -±± {‘date’: ‘Thu, 09 Oct 2025 13:34:51 GMT’, ‘transfer-encoding’: ‘chunked’, ‘connection’: ‘keep-alive’} -±± None - goodbye
^C2025-10-09 19:04:53,051 - MainThread - INFO -
— Shutdown signal received. Exiting. —
2025-10-09 19:04:53,051 - MainThread - INFO - — Disconnecting all streamers
 —
2025-10-09 19:04:53,076 - Thread-14 (run_forever) - WARNING - :police_car_light: [Streamer-1] Connection closed. Code: None, Reason: None
2025-10-09 19:04:53,105 - Thread-16 (run_forever) - WARNING - :police_car_light: [Streamer-2] Connection closed. Code: None, Reason: None
2025-10-09 19:04:53,129 - Thread-17 (run_forever) - WARNING - :police_car_light: [Streamer-3] Connection closed. Code: None, Reason: None
2025-10-09 19:04:53,130 - MainThread - INFO - — Service has been shut down. —
(ai-ml-new) ➜ nse-bse-scrapper git:(refactor-upstox-websocket-sdk) ✗

I am unable to make 4th connection, upto 3 connections are getting established all the time