Closed syedasif11 closed 11 months ago
Not happening on our end, please share your client code, team will connect and check.
Here is the code:
def message():
# Some work...
def reconnect():
# Check if connection reqd, and if yes, the try reconnection else pass
inst_tokens = [{"instrument_token": str(47871), "exchange_segment": "nse_fo"},
{"instrument_token": str(25), "exchange_segment": "nse_cm"}]
client.on_message = message
client.on_close = reconnect
client.subscribe(instrument_tokens=inst_tokens)
It can be because of connection or port issue. Check firewall settings. Alternatively, use on_connect and on_disconnect methods of websockets to log it and analyze.
@sacbhatia Thanks for the suggestion.
I figured out the hardway sometimes If there is any exceptions in the On_message you do loos the socket communication ..
check for any exceptions and handle the same .. This could be one issue and may be more .. just check once
It disconnects every 3 minutes or so and throws following message and
on_close
which is set usingneo_api.on_close
function is never called by the API:[OnClose]: Function is running HSWebsocket 1000
[OnClose]: Function is running HSWebsocket None