def main():
tornado.options.parse_command_line()
app = Application()
http_server = tornado.httpserver.HTTPServer(app)
http_server.listen(options.port)
LOGGER.info('[server.main] Starting server on http://127.0.0.1:%s', options.port)
try:
LOGGER.info("\n[server.main] Server Started.\n")
tornado.ioloop.IOLoop.current().start()
except KeyboardInterrupt:
LOGGER.error('\n[server.main] EXCEPTION KEYBOARDINTERRUPT INITIATED\n')
LOGGER.info("[server.main] Stopping Server....")
LOGGER.info('[server.main] closing all websocket connections objects and corresponsding mqtt client objects')
LOGGER.info('Stopping Tornado\'s main iolooop')
# Stopping main thread's ioloop, not to be confused with current thread's ioloop
# which is ioloop.IOLoop.current()
tornado.ioloop.IOLoop.instance().stop()
LOGGER.info("\n[server.main] Server Stopped.")
评论列表
文章目录