Hey, so I am attempting to implement the Websocket API using python’s socketio-client library. The following is a very basic program that should print “connect” on startup, then wait listen for an event via the web UI (next, pause, play, etc.), and then print out the pushState data.
1 from socketIO_client import SocketIO
4 def on_connect():
7 def on_disconnect():
10 def on_reconnect():
13 def statusInfo(*args):
16 socketIO = SocketIO('localhost', 3000)
17 socketIO.on('connect', on_connect)
18 socketIO.on('disconnect', on_disconnect)
19 socketIO.on('reconnect', on_reconnect)
21 socketIO.on('pushState', statusInfo)
However, when the event occurs (for example I skip a song) I get multiple instances of the pushState data being printed out on my screen. How do I get a single output of pushState per event?