Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18789

Does FastAPI websocket example deadlock the process?

$
0
0

The code in the docs has a while True: block and I am curious if something like that would deadlock the process. If I get two requests, would the second one just not go through? why or why not?

Source: https://fastapi.tiangolo.com/advanced/websockets/

@app.websocket("/ws")async def websocket_endpoint(websocket: WebSocket):    await websocket.accept()    while True:        data = await websocket.receive_text()        await websocket.send_text(f"Message text was: {data}")

Viewing all articles
Browse latest Browse all 18789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>