My* -> Grabber*

This commit is contained in:
Ivan Kozik 2015-07-18 10:57:57 +00:00
parent 47940fd09e
commit e42e33d82f
2 changed files with 8 additions and 8 deletions

View File

@ -9,7 +9,7 @@ import asyncio
import aiohttp.web
from autobahn.asyncio.websocket import WebSocketServerFactory, WebSocketServerProtocol
class MyServerProtocol(WebSocketServerProtocol):
class GrabberServerProtocol(WebSocketServerProtocol):
def __init__(self):
super().__init__()
self.mode = "dashboard"
@ -63,8 +63,8 @@ class MyServerProtocol(WebSocketServerProtocol):
})
class MyServerFactory(WebSocketServerFactory):
protocol = MyServerProtocol
class GrabberServerFactory(WebSocketServerFactory):
protocol = GrabberServerProtocol
def __init__(self):
super().__init__()
@ -98,7 +98,7 @@ def main():
httpCoro = httpServer(loop, httpInterface, httpPort)
loop.run_until_complete(httpCoro)
wsFactory = MyServerFactory()
wsFactory = GrabberServerFactory()
wsCoro = loop.create_server(wsFactory, wsInterface, wsPort)
loop.run_until_complete(wsCoro)

View File

@ -17,7 +17,7 @@ def printToReal(s):
sys.stdout.buffer.flush()
class MyClientProtocol(WebSocketClientProtocol):
class GrabberClientProtocol(WebSocketClientProtocol):
def onOpen(self):
self.factory.client = self
printToReal("{} connected to WebSocket server".format(self.__class__.__name__))
@ -37,15 +37,15 @@ class MyClientProtocol(WebSocketClientProtocol):
self.sendMessage(json.dumps(obj).encode("utf-8"))
class MyClientFactory(WebSocketClientFactory):
protocol = MyClientProtocol
class GrabberClientFactory(WebSocketClientFactory):
protocol = GrabberClientProtocol
def __init__(self):
super().__init__()
self.client = None
wsFactory = MyClientFactory()
wsFactory = GrabberClientFactory()
@asyncio.coroutine
def connectToServer():