def main(): import tornado.options lock = Lock("service") tornado.options.parse_command_line() def reload_hook(): """ Hook to release lock when autoreload is triggered. """ lock.delete() autoreload.add_reload_hook(reload_hook) config = ConfigurationManager.get().get("websocket") host = config.get("host") port = config.get("port") route = config.get("route") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") routes = [ (route, WebsocketEventHandler) ] application = web.Application(routes, **settings) application.listen(port, host) ioloop.IOLoop.instance().start()
def __init__(self, host=config.get("host"), port=config.get("port"), route=config.get("route"), ssl=config.get("ssl")): validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") self.build_url(host, port, route, ssl) self.emitter = EventEmitter() self.client = self.create_client() self.pool = ThreadPool(10) self.retry = 5
def __init__(self, host=None, port=None, route=None, ssl=None): config = Configuration.get().get("websocket") host = host or config.get("host") port = port or config.get("port") route = route or config.get("route") ssl = ssl or config.get("ssl") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") self.url = WebsocketClient.build_url(host, port, route, ssl) self.emitter = EventEmitter() self.client = self.create_client() self.pool = ThreadPool(10) self.retry = 5
def __init__(self, host=None, port=None, route=None, ssl=None): config = Configuration.get().get("websocket") host = host or config.get("host") port = port or config.get("port") route = route or config.get("route") ssl = ssl or config.get("ssl") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") self.url = WebsocketClient.build_url(host, port, route, ssl) self.emitter = ThreadedEventEmitter() self.client = self.create_client() self.retry = 5 self.connected_event = Event() self.started_running = False
def main(): import tornado.options lock = Lock("service") tornado.options.parse_command_line() config = ConfigurationManager.get().get("websocket") host = config.get("host") port = config.get("port") route = config.get("route") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") routes = [(route, WebsocketEventHandler)] application = web.Application(routes, **settings) application.listen(port, host) ioloop.IOLoop.instance().start()
def main(): import tornado.options tornado.options.parse_command_line() config = ConfigurationManager.get().get("websocket") host = config.get("host") port = config.get("port") route = config.get("route") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") routes = [ (route, WebsocketEventHandler) ] application = web.Application(routes, **settings) application.listen(port, host) ioloop.IOLoop.instance().start()
def main(): global skill_response, wait_response, port, lang wait_response = True skill_response = "" global ws ws = WebsocketClient() event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() ws.on('speak', handle_speak) import tornado.options tornado.options.parse_command_line() config = ConfigurationManager.get().get("websocket") lang = ConfigurationManager.get().get("lang") host = config.get("host") port = config.get("port") route = config.get("route") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") routes = [(route, WebsocketEventHandler), tornado.web.url(r"/", MainHandler, name="main"), tornado.web.url(r"/static/(.*)", tornado.web.StaticFileHandler, {'path': './'}), tornado.web.url(r"/ws", WebSocketHandler)] settings = { "debug": True, "template_path": os.path.join(os.path.dirname(__file__), "templates"), "static_path": os.path.join(os.path.dirname(__file__), "static"), } application = tornado.web.Application(routes, **settings) httpServer = tornado.httpserver.HTTPServer(application) tornado.options.parse_command_line() httpServer.listen(port) tornado.ioloop.IOLoop.instance().start()
def main(): import tornado.options lock = Lock("service") tornado.options.parse_command_line() def reload_hook(): """ Hook to release lock when autoreload is triggered. """ lock.delete() tornado.autoreload.add_reload_hook(reload_hook) config = ConfigurationManager.get().get("websocket") host = config.get("host") port = config.get("port") route = config.get("route") validate_param(host, "websocket.host") validate_param(port, "websocket.port") validate_param(route, "websocket.route") routes = [(route, WebsocketEventHandler)] application = web.Application(routes, **settings) application.listen(port, host) ioloop.IOLoop.instance().start()