Attempting to resubscribe/reconnect
-
Hello,
I have been using WebSocket in my Python code for a while. Today, I had to reinstall smartapi-python and websocket-client because my virtual environment's library got deleted by mistake. I didn't make any changes to my Python code. After reinstalling these libraries, I started encountering the error message 'Attempting to resubscribe/reconnect'. The code was working fine until yesterday.
Why is this error appearing now?
I am using Python 3.10.7.
-
@0xc0de Yes, I managed to fix it. There was a small error in my code. Strangely the previous version of smartapi-python did not have any issues with this error, but the new version did. As soon as I installed the new version, the problem started appearing.
It is easy to check if your code also has some existing issues. In the smartWebSocketV2, in the _on_error function, print the error message, and it will show what is wrong with your code:
def _on_error(self, wsapp, error):
print(f'error: {error}') -
@Moderator_3 I am getting the same error, and it's before anything is received, in the connect().
@whemant Were you able to get around this? I too am facing the same issue, my code worked some time ago, not working today when I tried on a new system. I see that the code doesn't have any commits since the last year, so @Moderator_3 I think it could be any of the dependencies of this library rather the library itself. Could you please look into it? -
Hello @whemant
CHECK the following in your code...
can you print the received tick as it is ? ...the printed data should tell you if there is an error ...if printed data shows buy/sell or ltp etc..you have no connection/subsciption problems....
are you calling any function or processing (ie, doing any thing to received data for the strategy...)the received data ?
if yes, thoroughly check that code...any error in that code will cause an error for websocket client and cause it to fire its on_error...which is "Attempting...."...but the actual error was an execution error in the post processing function/routine....
Regards,
SmartAPI Team