|
@ -137,10 +137,18 @@ def start_server(address, port, heartbeat_interval, heartbeat_timeout): |
|
|
The timeout for waiting for a response in seconds. |
|
|
The timeout for waiting for a response in seconds. |
|
|
""" |
|
|
""" |
|
|
loop = asyncio.get_event_loop() |
|
|
loop = asyncio.get_event_loop() |
|
|
heartbeat_task = loop.create_task( |
|
|
# Python 3.7+, coroutines only: |
|
|
|
|
|
# heartbeat_task = loop.create_task( |
|
|
|
|
|
# heartbeat(sio, heartbeat_interval, heartbeat_timeout) |
|
|
|
|
|
# ) |
|
|
|
|
|
# aiohttp_app = loop.create_task(web._run_app(app, host=address, port=port)) |
|
|
|
|
|
|
|
|
|
|
|
# Python 3.6+ compatible. Supports any awaitable: |
|
|
|
|
|
heartbeat_task = asyncio.ensure_future( |
|
|
heartbeat(sio, heartbeat_interval, heartbeat_timeout) |
|
|
heartbeat(sio, heartbeat_interval, heartbeat_timeout) |
|
|
) |
|
|
) |
|
|
aiohttp_app = loop.create_task(web._run_app(app, host=address, port=port)) |
|
|
|
|
|
|
|
|
aiohttp_app = asyncio.ensure_future(web._run_app(app, host=address, port=port)) |
|
|
|
|
|
|
|
|
exit_handler = create_exit_handler(loop, heartbeat_task) |
|
|
exit_handler = create_exit_handler(loop, heartbeat_task) |
|
|
signal.signal(signal.SIGINT, exit_handler) |
|
|
signal.signal(signal.SIGINT, exit_handler) |
|
|