Websocket with 5 different connection

We have upgraded out account to Websocket plus and trying to connect multiple socket.

Once, we are getting web socket URL (AuthorizedRedirectUri) then trying to open 5 different connection with same URL & same accesstoken.

Only 1st connection is established successfully, we are getting below error for remaining 4 connection. Please advise.

2025-06-12 12:57:06.1538|OnError Connection 1: Unable to connect to the remote server
2025-06-12 12:57:07.1574|OnError Connection 2: Unable to connect to the remote server
2025-06-12 12:57:08.1644|OnError Connection 3: Unable to connect to the remote server
2025-06-12 12:57:09.1912|OnError Connection 4: Unable to connect to the remote server

2025-06-12 12:58:05.0909|Attempting to reconnect connection 1
2025-06-12 12:58:05.0909|GetMarketDataFeedAuthorizeAsync - Error getting FeedAuthorize: Cannot add value because header ‘Authorization’ does not support multiple values.
2025-06-12 12:58:05.0909|Attempting to reconnect connection 2
2025-06-12 12:58:05.0909|GetMarketDataFeedAuthorizeAsync - Error getting FeedAuthorize: Cannot add value because header ‘Authorization’ does not support multiple values.
2025-06-12 12:58:05.0909|Attempting to reconnect connection 3
2025-06-12 12:58:05.0909|GetMarketDataFeedAuthorizeAsync - Error getting FeedAuthorize: Cannot add value because header ‘Authorization’ does not support multiple values.
2025-06-12 12:58:05.0909|Attempting to reconnect connection 4
2025-06-12 12:58:05.0909|GetMarketDataFeedAuthorizeAsync - Error getting FeedAuthorize: Cannot add value because header ‘Authorization’ does not support multiple values.

You will need to get different url for each connection

Thank you for your quick response.

Do you mean, we need to call & get AuthorizedRedirectUri with same access token for 5 different connection? I mean call 5 times to get AuthorizedRedirectUri.

Yes

@Samiksha_47544883 Yes, the same authorized_redirect_uri will not work for different connections.

Thank you for your quick support.

Now, we are connected 5 socket connection successfully but disconnect & reconnect again & again. See the logs below and advise.

They have limited connections to 2 only from one client id

We have upgraded our account to “plus” & I can see 5 connections are allowed & successfully connected. See the logs below.


2025-06-18 13:47:48.0578|{ “AccessToken” : “My Access Token”, “RefreshToken” : null, “TokenType” : null, “ExpiresIn” : 0 }
2025-06-18 13:47:48.0773|calling GetMarketDataFeedAuthorizeAsync for multiple connections: Connect via new access Token
2025-06-18 13:47:48.0823|Getting authorization URL for connection 0
2025-06-18 13:47:48.1975|Connection 0 - Authorization URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=ee28216e-007c-40ab-857c-d6807f46eccc&code=4frvD-876b7693-ed28-4aef-82e4-1465456abe5e
2025-06-18 13:47:48.6028|Getting authorization URL for connection 1
2025-06-18 13:47:48.6593|Connection 1 - Authorization URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=364a22c5-43e5-4d15-ae10-8d64f40cef5e&code=Kk8Jr-e3cfb66b-326e-478b-a419-0b5af93a7d4a
2025-06-18 13:47:49.1277|Getting authorization URL for connection 2
2025-06-18 13:47:49.1944|Connection 2 - Authorization URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=f6d123d2-0e4b-4f52-a111-6c7e84afe827&code=SNPsE-b1ceb131-bde6-4734-9924-81cafd6ac38a
2025-06-18 13:47:49.6385|Getting authorization URL for connection 3
2025-06-18 13:47:49.6914|Connection 3 - Authorization URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=1a4872cd-0a83-4b1b-9bb0-6060d8e4a9b1&code=N5hC7-2099a792-2a13-47bd-b126-aa97fa5c726b
2025-06-18 13:47:50.1468|Getting authorization URL for connection 4
2025-06-18 13:47:50.1946|Connection 4 - Authorization URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=ae8d30c5-c0be-442d-bb41-153ada74af34&code=tqrLs-aa8dfdb7-c96b-462b-9b57-48d6d820c5d6
2025-06-18 13:47:50.6802|Successfully retrieved 5 authorization URLs
2025-06-18 13:47:50.6802|Retrieved 5 authorization URLs for connections
2025-06-18 13:47:50.6802|Initialized connection 0 with URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=ee28216e-007c-40ab-857c-d6807f46eccc&code=4frvD-876b7693-ed28-4aef-82e4-1465456abe5e
2025-06-18 13:47:50.6802|Initialized connection 1 with URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=364a22c5-43e5-4d15-ae10-8d64f40cef5e&code=Kk8Jr-e3cfb66b-326e-478b-a419-0b5af93a7d4a
2025-06-18 13:47:50.6802|Initialized connection 2 with URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=f6d123d2-0e4b-4f52-a111-6c7e84afe827&code=SNPsE-b1ceb131-bde6-4734-9924-81cafd6ac38a
2025-06-18 13:47:50.6802|Initialized connection 3 with URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=1a4872cd-0a83-4b1b-9bb0-6060d8e4a9b1&code=N5hC7-2099a792-2a13-47bd-b126-aa97fa5c726b
2025-06-18 13:47:50.6802|Initialized connection 4 with URL: wss://wsfeeder-api.upstox.com/market-data-feeder/v3/upstox-developer-api/feeds?requestId=ae8d30c5-c0be-442d-bb41-153ada74af34&code=tqrLs-aa8dfdb7-c96b-462b-9b57-48d6d820c5d6
2025-06-18 13:47:50.6950|Wait for 20 seconds for all connections to establish
2025-06-18 13:47:50.7952|OnWebSocketOpen: Connection 0 established
2025-06-18 13:47:51.0095|Connection 0 - Market Info: { “NSE_COM” : “NORMAL_OPEN”, “NCD_FO” : “NORMAL_OPEN”, “NSE_FO” : “NORMAL_OPEN”, “BSE_EQ” : “NORMAL_OPEN”, “BCD_FO” : “NORMAL_OPEN”, “BSE_FO” : “NORMAL_OPEN”, “NSE_EQ” : “NORMAL_OPEN”, “MCX_FO” : “NORMAL_OPEN”, “US_EQ” : “NORMAL_CLOSE”, “MCX_INDEX” : “NORMAL_OPEN”, “NSE_INDEX” : “NORMAL_OPEN”, “BSE_INDEX” : “NORMAL_OPEN” }
2025-06-18 13:47:51.0095|BSE_EQ - NORMAL_OPEN
2025-06-18 13:47:51.0095|NSE_EQ - NORMAL_OPEN
2025-06-18 13:47:51.7779|OnWebSocketOpen: Connection 1 established
2025-06-18 13:47:51.7779|Connection 1 - Market Info: { “NSE_COM” : “NORMAL_OPEN”, “NCD_FO” : “NORMAL_OPEN”, “NSE_FO” : “NORMAL_OPEN”, “BSE_EQ” : “NORMAL_OPEN”, “BCD_FO” : “NORMAL_OPEN”, “BSE_FO” : “NORMAL_OPEN”, “NSE_EQ” : “NORMAL_OPEN”, “MCX_FO” : “NORMAL_OPEN”, “US_EQ” : “NORMAL_CLOSE”, “MCX_INDEX” : “NORMAL_OPEN”, “NSE_INDEX” : “NORMAL_OPEN”, “BSE_INDEX” : “NORMAL_OPEN” }
2025-06-18 13:47:51.7779|BSE_EQ - NORMAL_OPEN
2025-06-18 13:47:51.7779|NSE_EQ - NORMAL_OPEN
2025-06-18 13:47:52.7913|OnWebSocketOpen: Connection 2 established
2025-06-18 13:47:52.7913|Connection 2 - Market Info: { “NSE_COM” : “NORMAL_OPEN”, “NCD_FO” : “NORMAL_OPEN”, “NSE_FO” : “NORMAL_OPEN”, “BSE_EQ” : “NORMAL_OPEN”, “BCD_FO” : “NORMAL_OPEN”, “BSE_FO” : “NORMAL_OPEN”, “NSE_EQ” : “NORMAL_OPEN”, “MCX_FO” : “NORMAL_OPEN”, “US_EQ” : “NORMAL_CLOSE”, “MCX_INDEX” : “NORMAL_OPEN”, “NSE_INDEX” : “NORMAL_OPEN”, “BSE_INDEX” : “NORMAL_OPEN” }
2025-06-18 13:47:52.7913|BSE_EQ - NORMAL_OPEN
2025-06-18 13:47:52.7913|NSE_EQ - NORMAL_OPEN
2025-06-18 13:47:53.7917|OnWebSocketOpen: Connection 3 established
2025-06-18 13:47:53.7917|Connection 3 - Market Info: { “NSE_COM” : “NORMAL_OPEN”, “NCD_FO” : “NORMAL_OPEN”, “NSE_FO” : “NORMAL_OPEN”, “BSE_EQ” : “NORMAL_OPEN”, “BCD_FO” : “NORMAL_OPEN”, “BSE_FO” : “NORMAL_OPEN”, “NSE_EQ” : “NORMAL_OPEN”, “MCX_FO” : “NORMAL_OPEN”, “US_EQ” : “NORMAL_CLOSE”, “MCX_INDEX” : “NORMAL_OPEN”, “NSE_INDEX” : “NORMAL_OPEN”, “BSE_INDEX” : “NORMAL_OPEN” }
2025-06-18 13:47:53.7917|BSE_EQ - NORMAL_OPEN
2025-06-18 13:47:53.7917|NSE_EQ - NORMAL_OPEN
2025-06-18 13:47:54.8034|OnWebSocketOpen: Connection 4 established
2025-06-18 13:47:54.8034|Connection 4 - Market Info: { “NSE_COM” : “NORMAL_OPEN”, “NCD_FO” : “NORMAL_OPEN”, “NSE_FO” : “NORMAL_OPEN”, “BSE_EQ” : “NORMAL_OPEN”, “BCD_FO” : “NORMAL_OPEN”, “BSE_FO” : “NORMAL_OPEN”, “NSE_EQ” : “NORMAL_OPEN”, “MCX_FO” : “NORMAL_OPEN”, “US_EQ” : “NORMAL_CLOSE”, “MCX_INDEX” : “NORMAL_OPEN”, “NSE_INDEX” : “NORMAL_OPEN”, “BSE_INDEX” : “NORMAL_OPEN” }
2025-06-18 13:47:54.8034|BSE_EQ - NORMAL_OPEN
2025-06-18 13:47:54.8034|NSE_EQ - NORMAL_OPEN


My concern is the socket connection are getting disconnect & reconnect again & again.

Can you please check our account logs & advise what caused this issue. This will help us to troubleshoot the issue and apply required changes if needed.

Hi @Samiksha_47544883,

We noticed that the connection appears to have been terminated from your end. Please refer to the WebSocket sample code for proper implementation guidance.

If you’re still facing the same issue, kindly share your code so we can investigate further.

Also, ensure that you’re not exceeding the connection and subscription limits as outlined here

My Client Code: 3YCAGL

We are using .net SDK for our application.

Please find the attached source code of SDK & my class file to connect Socket. Take your time to review both code and advise the required changes to fix the connection issue.

Dear Support Team,

Any update on this?

Thanks