Created
January 17, 2013 05:33
-
-
Save payden/4553917 to your computer and use it in GitHub Desktop.
libwebsock-python gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import libwebsock | |
def ws_onopen(client): | |
print "New connection from {0}".format(client.sock) | |
def ws_onclose(client) | |
print "Connection closed: {0}".format(client.sock) | |
def ws_onmessage(client, msg): | |
print "Received message from client ({0}): {1}".format(client.sock, msg.payload) | |
libwebsock.onopen(ws_onopen) | |
libwebsock.onclose(ws_onclose) | |
libwebsock.onmessage(ws_onmessage) | |
libwebsock.run(3333) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment