- add subscription via MessageDispatcher
This commit is contained in:
@@ -5,10 +5,13 @@ import abc
|
||||
|
||||
class WsServer:
|
||||
def __init__(self, loop=None):
|
||||
if loop is None:
|
||||
self.loop = asyncio.get_event_loop()
|
||||
self.loop = loop
|
||||
|
||||
def run_forever(self):
|
||||
if self.loop is None:
|
||||
asyncio.get_event_loop().run_forever()
|
||||
else:
|
||||
self.loop = loop
|
||||
self.loop.run_forever()
|
||||
|
||||
async def listen(self, host, port):
|
||||
return await websockets.serve(self.handler, host, port, loop=self.loop)
|
||||
|
||||
Reference in New Issue
Block a user