Kill or reset sws connection


  • Currently there is a limit of 3 connections per client code for Websocket Streaming.

    As we know, i need to reset or kill previous create sws connection any method to kill this sws connection

    I am creating one strategy per deploy each deploy create one sws connection how to close previous sws connection i am unable to store sws connection object

    please help me Its big issue for me

    I am using python for this
    I know how to unsubscribe
    but how to store sws connection object and second time api call close the previous connection

    sws.unsubscribe(correlation_id, mode, token_list)
    cl = sws.close_connection()


  • I assume your deployed strategy is running while you redeploy a new strategy, and this is leaving the websocket in previous deployment still alive, causing a leak.

    One simple way is to handle keyboard interrupt.
    https://stackoverflow.com/questions/4205317/capture-keyboardinterrupt-in-python-without-try-except

    Make sure you do the websocket connection inside a new thread. Use the main thread for the signal handler as shown in above url. Perform cleanup (unsubscribe+disconnect) in the signal handler function.