from sanic import Sanic from sanic.response import file from InputController import InputController app = Sanic("capybara") app.ctx.input_controller = InputController() app.static("app", "frontend/dist/", resource_type="dir") @app.websocket("/gateway") async def gateway(req, ws): while True: app.ctx.input_controller.process_message(await ws.recv()) def main(): app.run(host='0.0.0.0', port=4003, access_log=False) if __name__ == "__main__": main()