Last active
December 17, 2015 23:48
-
-
Save bluepnume/5691482 to your computer and use it in GitHub Desktop.
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
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