def onmessage(client, msg): print "Client {0} sent message: {1}".format(client, msg) # echo message back to all clients excluding who sent it for c in libwebsock.connected_clients(): if c != client: print "Sending message from {0} to {1}".format(client, c) libwebsock.send(c, msg)
def onopen(client): print "New Client: {0}".format(client) print "Current conn list: {0}".format(libwebsock.connected_clients()) print "PINGING" libwebsock.ping(client)
def onclose(client): print "Closing client: {0}".format(client) print "Current conn list: {0}".format(libwebsock.connected_clients())