Hi @DO4oDGcq5n ,
I faced this issue today as well, I’ll put here exactly how to recreate it.
on_connect call back
## self.data_types = ["SymbolUpdate", "DepthUpdate"]
## self.symbol = ['NSE:NIFTY25O1425300CE', 'NSE:NIFTY25O2025250PE', 'NSE:NIFTY25O1425300PE', 'NSE:NIFTY25O2025150CE', 'NSE:NIFTY25O1425150CE', 'NSE:NIFTY25O2025300CE', 'NSE:NIFTY25OCTFUT', 'NSE:NIFTY25O2025250CE', 'NSE:NIFTY25O1425350CE', 'NSE:NIFTY25O2025350PE', 'NSE:NIFTY25O2025150PE', 'NSE:NIFTY25O1425200CE', 'NSE:NIFTY25O1425150PE', 'NSE:NIFTY25O1425250CE', 'NSE:NIFTY25O1425250PE', 'NSE:NIFTY25O1425350PE', 'NSE:NIFTY25O2025200CE', 'NSE:NIFTY25O2025200PE', 'NSE:NIFTY25O1425200PE', 'NSE:NIFTY25O2025350CE', 'NSE:NIFTY25O2025300PE', 'NSE:NIFTY50-INDEX', 'NSE:INDIAVIX-INDEX']
@handle_exception(svc=service)
def on_connect(self):
for data_type in self.data_types:
c_symbol = self.symbol
if data_type == 'DepthUpdate' and 'NSE:NIFTY50-INDEX' in c_symbol:
c_symbol.remove('NSE:NIFTY50-INDEX')
c_symbol.remove('NSE:INDIAVIX-INDEX')
self.data_socket.subscribe(data_type=data_type, symbols=c_symbol)
self.logger.trace(f"subscribed symbols: {self.data_socket.symbols}, scrips: {self.data_socket.scrips}")
# Keep the socket running to receive real-time data
self.data_socket.keep_running()
I understand that sample script doesn’t get this error, but real-world implementations are much complex.
The only reason I have to subscribe to “SymbolUpdate”, “DepthUpdate” both is because the symbol update socket doesn’t provide depth data.
can we please take a look into it?
for now, I’ve added a fix that mitigates it by forceful reconnection.
# self.ff_rebalance_limit = 6
# in on_message callback after checking for all expected types
# symbol and type come as integers
elif isinstance(msg['symbol'], int) and isinstance(msg['type'], int):
self.logger.warn(f"Fyers issue:{msg}")
if self.ff_rebalance_limit > 0:
self.invoke_rebalance() # my custom function to unsubscribe and resubscribe
self.ff_rebalance_limit -= 1
else:
self.logger.info(f"msg:{msg}")
I hope this helps recreating the issue on your side.