Python autobahn.twisted.websocket.WebSocketClientProtocol() Examples
The following are 2
code examples of autobahn.twisted.websocket.WebSocketClientProtocol().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
autobahn.twisted.websocket
, or try the search function
.
Example #1
Source File: testWSProtocol.py From wslink with BSD 3-Clause "New" or "Revised" License | 6 votes |
def pushImage(self): self.protocol.pushImage() # Client is created for each test, connects and disconnects. # class MyClientProtocol(WebSocketClientProtocol): # def onOpen(self): # self.sendMessage(u"Hello, world!".encode('utf8')) # def onMessage(self, payload, isBinary): # if isBinary: # print("Binary message received: {0} bytes".format(len(payload))) # else: # print("Text message received: {0}".format(payload.decode('utf8'))) # clientFactory = WebSocketClientFactory(u"ws://127.0.0.1:9090") # clientFactory.protocol = MyClientProtocol # ----------------------------------------------------------------------------- # Testing Taken from autobahn/test/__init__.py # -----------------------------------------------------------------------------
Example #2
Source File: ws_client.py From magic-wormhole-mailbox-server with MIT License | 5 votes |
def __init__(self): websocket.WebSocketClientProtocol.__init__(self) self.events = [] self.errors = [] self.d = None self.ping_counter = itertools.count(0)