Issue with Web Socket API

Hi guys,

I have implemented code to connect to the websocket server as I need to be able to receive messages regarding training etc. The project I am building does not use an SDK but the API directly and is being programmed in Python. The websockets library is websocket-client.

I retrieve the socket token successfully per the docs:

It appears to connect, but the message received is very different from the one in the docs:
> 0{"sid":"EAjjjM8afISrnrdCALAM","upgrades":[],"pingInterval":25000,"pingTimeout":5000}

I wanted to check if this has actually connected properly as I have code that runs every 20 seconds publishing “2” to keep the connection alive but it fails with “connection already closed”

Message received...
Message received...
Sent keepalive
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/", line 916, in _bootstrap_inner
  File "/usr/lib/python3.6/", line 1182, in run
    self.function(*self.args, **self.kwargs)
  File "/home/jetson-nano/ei_jetson_trainer/classes/", line 30, in run"2")
  File "/home/jetson-nano/.local/lib/python3.6/site-packages/websocket/", line 205, in send
    "Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

Thanks in advance.

Ok not sure what the issue was it has now started working.