Skip to content

Instantly share code, notes, and snippets.

@payden
Created January 17, 2013 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save payden/4553917 to your computer and use it in GitHub Desktop.
Save payden/4553917 to your computer and use it in GitHub Desktop.
libwebsock-python gist
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