Unable to send token stored in variables in subscribe method

I am trying to store all the tokens that I want to subscribe in a list and then use that list variable inside on_connect method like this:
def on_connect(ws, response):
# Callback on successful connect.
ws.set_mode(ws.MODE_FULL, token)
This is throwing me an error: Connection error: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: close reason without close code)

NOTE: Even using the global keyword inside the on_connect() method, it's not working. Is there any other way where I can specify the tokens directly using a variable without me having to input it every time?

Sign In or Register to comment.