Am Getting this error. It was working fine since morning. But its showing this error now.
Hi @Mahikbs ,
Kindly share a sample of your WebSocket connection code so we can assist you more effectively.
Happy Trading !
def websocket_process(redis_config):
print(f"websocket_process--------------")
r = redis.Redis(**redis_config)
watchlist = json.loads(r.get("watchlist"))
new_instruments, new_rows, _ = prepare_instruments(watchlist)
print(f"instruments = {new_instruments}")
# Connect to the market feed using the instruments created
data = marketfeed.DhanFeed(CLIENT_CODE, TOKEN_ID, new_instruments)
print(f"Establishing connection fr {CLIENT_CODE} --> {TOKEN_ID}")
data.run_forever()
while True:
response = data.get_data()
if response:
# If LTP data is present, update Redis and publish to the channel for subscribers
if 'LTP' in response:
security_id = response.get('security_id')
ltp = response.get("LTP")
print(f"{datetime.datetime.now().time()}: LTP Received for {symbol_security_id_mapping[security_id]} = {ltp}")
# Store the latest LTP in Redis (with a short expiry to avoid stale data)
r.set(f"LTP:{symbol_security_id_mapping[security_id]}", ltp, ex=60)
# Publish LTP update to a channel (subscribers can then trigger order modifications)
message = json.dumps({"symbol": symbol_security_id_mapping[security_id], "LTP": ltp})
r.publish("ltp_updates", message)
Hi @Mahikbs ,
As checked, it appears to be a coding-level issue, as everything is working fine on our end. Please review and debug your code, then try again.