Skip to content

Instantly share code, notes, and snippets.

@bluepnume
Last active December 17, 2015 23:48
Show Gist options
  • Save bluepnume/5691482 to your computer and use it in GitHub Desktop.
Save bluepnume/5691482 to your computer and use it in GitHub Desktop.
from twisted.internet import reactor
from autobahn.websocket import WebSocketClientFactory, \
WebSocketClientProtocol, \
connectWS
from twisted.internet import stdio
class MessageBasedHashClientProtocol(WebSocketClientProtocol):
def onOpen(self):
print 'open'
def onMessage(self, message, binary):
print 'message:', message
if __name__ == '__main__':
factory = WebSocketClientFactory('ws://localhost:8080')
factory.protocol = MessageBasedHashClientProtocol
connectWS(factory)
reactor.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment