mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-14 03:47:17 +00:00
21 lines
587 B
Python
21 lines
587 B
Python
from tornado.web import Application
|
|
|
|
from tfw.networking.server.controller_responder import ControllerResponder
|
|
from tfw.networking.server.zmq_websocket_handler import FSMManagingSocketHandler
|
|
|
|
|
|
class TFWServer:
|
|
def __init__(self, fsm_type):
|
|
self._fsm = fsm_type()
|
|
self.application = Application(
|
|
[(r'/ws', FSMManagingSocketHandler, {'fsm': self.fsm})]
|
|
)
|
|
self.controller_responder = ControllerResponder(self.fsm)
|
|
|
|
@property
|
|
def fsm(self):
|
|
return self._fsm
|
|
|
|
def listen(self, port):
|
|
self.application.listen(port)
|