Relative Content

Tag Archive for pythonflutterwebsocketfastapi

FastAPI Websocket not closing or raising exception after closing the associated Flutter Websocket

Possible Working Solution After some time digging through StackOverflow and Reddit, i’ve tried the following code within my while True loop: try: await asyncio.wait_for( websocket.receive_text(), timeout=0.1) except asyncio.TimeoutError: pass It seems to trigger a WebSocketDisconnect exception when the websocket is already closed. For anyone having a similar problem, try it out! I’m going to experiment […]