Market Data Feed Websocket Issues

Today, I am facing issues with websocket API. Connection is getting stuck and on it works fine on retry. It was working fine till Yesterday.

Facing issues with multiple tickers Today.

2 Likes

Team - please advise on this urgently.

Are there any recent changes to the Market Data Feed Websocket API?

On opening websocket for multiple instruments (say 5-6), I am getting message for only 2-3 instruments and for others, connection remains open and stuck.

Is there a limit of websocket connections I can have?

Please advise what changed Today?

thanks.

@Ashu_G, please rest assured that there have been no changes to the Market Data Feed WebSocket API. Could you kindly share your code or provide the list of instruments you are subscribing to for further review?

Please note that if there is no change in the price of a specific instrument between ticks, it will not appear in the subsequent tick. This could explain why you are not receiving messages for 2-3 instruments.

Additionally, you are allowed up to 3 WebSocket connections per user, with a subscription limit of up to 100 instruments per connection.

Thank you.

Observed same issue since sept 10th in my end as well. After connecting the WebSocket client, I used to receive the initial_feed first. But now for some of the WebSocket clients, even this initial_feed is not received. And later when market opens, no data will be received in this clients.

@Ketan, you have mentioned, that only 3 WebSocket connection is allowed per access token. Is it documented some where, because this is the first time I am coming across this constrain. Does this 3 connection include the Portfolio Stream Feed?.

1 Like

The issue persists even when the WebSocket count is limited to 3.

To address this, I implemented a retry mechanism to ensure data is received, which may be helpful for others facing similar issues.

    async def _manage_market_feed(self):
        await self._open_rx_logging_file()
        max_retries = 10
        timeout = 2
        for attempt in range(max_retries):
            try:
                # The websocket sometime does not give data even if the connection and subscription was successful.
                # Hence, this retry mechanism was implemented to make sure the first data is received.
                logging.info(f"{self._websocket_name}: Attempt {attempt + 1} to connect and subscribe...")
                await self._connect()
                await self._subscribe()
                await self.process_data(timeout)
                break
            except asyncio.TimeoutError:
                logging.warning(f"No data received for {timeout} seconds on {self._websocket_name}, reconnecting...")
                await self._disconnect()
        while True:
            await self.process_data()

Here, even if the WebSocket connection is successful and the subscription request is sent, if the first data packet is not received within the timeout period, it is considered a failed connection. The mechanism will then retry to receive the first data packet by reconnecting to the WebSocket.

1 Like

Hi Ketan,

I am facing same issue from 10th sept. As per three socket connection concern, i am calling only three webscoket call and not every time calling three times…
1- First time calling for historical data.
2- For recent 1 min candle data.
3- this call is not every time, we call third time only when we placing order, but still facing issue.

and one thing it works for the first time, when again it call it doesn’t work.
All thing was working firn from four month, what happened suddenly without any changes?

Here i can see many people are saying same thing. please check from your end.

Here are my separate complaint link…
https://community.upstox.com/t/api-is-not-working-websocket-connection-is-stopping/6587

Please look into this issue.

Thanks

@ShalabhSaurabh, could you please share the error you’re encountering so we can investigate further?

@Ketan @Ketan_Gupta It is not throwing any exception, my code is written in following manner

Get market data feed authorization

response = get_market_data_feed_authorize(
api_version, configuration)

and in response we are not getting any exception or error.

Hi Team,

Can we have any update on this ?

@Ketan Hi Team,

Can we have any update ?

@ShalabhSaurabh, we are currently looking into this issue and have forwarded the details to the relevant team.

Also could you please share your 6-digit user ID for further investigation?

Thank you!

@Ketan So are you able to replicate the issue or got the issue ?

Please update me.

@Ketan I am getting only following type of response:

{ā€˜data’: {ā€˜authorized_redirect_uri’: ā€˜wss://wsfeeder-api.upstox.com/market-data-feeder/v2/upstox-developer-api/feeds?requestId=aa158483-f699-463a-8166-030b1786e3ea&code=2PfZM-bc14c49c-add1-40dc-b7aa-c88e57dddd22’},
ā€˜status’: ā€˜success’}

@Ketan is there any update on the issue. I’m still facing the issue.

1 Like

Even I have same issue. I connect websocket at 9:14AM and no ticks are recieved from 9:15AM. But when I restart websocket it works

1 Like

Hi @G_K_Abhinand and @deeeepak,

Could you please help us understand how you’re connecting? Are you using our SDK or a socket client that you manage? If you’re using the SDK, which programming language are you using? This information will help us narrow down the issue.

Thank you for your understanding.

@ShalabhSaurabh - are you still facing issues connecting to the socket?

@shanmu I’m making use of the upstox java SDK, version 1.1.0. I’m generating the websocket uri using the SDK method getMarketDataFeedAuthorize(ā€œ2.0ā€).
Then create the WebSocketClient using that uri and connect to it.

Hi @shanmu ,

I am using python SDK - https://github.com/upstox/upstox-python/blob/master/examples/websocket/market_data/websocket_client.py

I was reading the forum and read it may be due to max retires
earlier my websocket was making connection at 9:14:40 AM
I changed start time to 9:14:55 to avoid max retries
I didn’t had problem today.

@shanmu Yes, As per your following SDK i have implemented my code