Issue with websocket close_connection()


  • This is for the Python SDK.

    When I try to close the connection using the line sws.close_connection(), I always get
    [W 240823 15:00:24 smartWebSocketV2:319] Attempting to resubscribe/reconnect (Attempt 1)...
    followed by
    [W 240823 15:00:34 smartWebSocketV2:343] Connection closed due to max retry attempts reached. This happens when I forcefully terminate the thread using the ctypes library.

    If I don't forcefully terminate the thread, it just reconnects and subscribes to the feed.

    Why is this happening Admin? I checked line 343 in the source file and it's in the _on_error method. Why is close_connection generating an error?

    Also the sws.unsubscribe() method tries to resubscribe immediately as the self.RESUBSCRIBE_FLAG is set to True. It should be set to False when we are trying to unsubscribe.


  • @pari

    We are working on it.

    Regards,
    SmartAPI Team


  • Any response Admin? I noticed that the DISCONNECT flag is set to true in the close_connection() method, but in the connect() method it is set to run_forever without ever checking the DISCONNECT flag.