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
2
3
4 def on_connect():
5 print('connect')
6
7 def on_disconnect():
8 print('disconnect')
9
10 def on_reconnect():
11 print('reconnect')
12
13 def statusInfo(*args):
14 print(args)
15
16 socketIO = SocketIO('localhost', 3000)
17 socketIO.on('connect', on_connect)
18 socketIO.on('disconnect', on_disconnect)
19 socketIO.on('reconnect', on_reconnect)
20
21 socketIO.on('pushState', statusInfo)
22 socketIO.wait()
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?