hi I want to use tornado websocket client and I see this document:
http://www.tornadoweb.org/en/stable/websocket.html#client-side-supportbut I can't findout how to use It .
I know how to write It by twisted but I want to know how to hendle It by tornado?
this is my twisted code:
from twisted.internet import reactor
from autobahn.websocket import WebSocketClientFactory, WebSocketClientProtocol, connectWS
class EchoClientProtocol(WebSocketClientProtocol):
def sendHello(self):
self.sendMessage("Hello, world!")
def onOpen(self):
self.sendHello()
def onMessage(self, msg, binary):
print "Got echo: " + msg
reactor.callLater(1, self.sendHello)
if __name__ == '__main__':
factory = WebSocketClientFactory("ws://localhost:8000/cart/status")
factory.protocol = EchoClientProtocol
connectWS(factory)
reactor.run()