mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 18:23:55 +00:00
13 lines
384 B
Python
13 lines
384 B
Python
from fastapi import WebSocket
|
|
# fastapi does not make this available through it, so import directly from starlette
|
|
from starlette.websockets import WebSocketState
|
|
|
|
|
|
async def is_websocket_alive(ws: WebSocket) -> bool:
|
|
if (
|
|
ws.application_state == WebSocketState.CONNECTED and
|
|
ws.client_state == WebSocketState.CONNECTED
|
|
):
|
|
return True
|
|
return False
|