Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for handling (0.14 sec)

  1. docs/en/docs/advanced/websockets.md

    !!! tip
        Notice that the query `token` will be handled by a dependency.
    
    With that you can connect the WebSocket and then send and receive messages:
    
    <img src="/img/tutorial/websockets/image05.png">
    
    ## Handling disconnections and multiple clients
    
    When a WebSocket connection is closed, the `await websocket.receive_text()` will raise a `WebSocketDisconnect` exception, which you can then catch and handle like in this example.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  2. docs/en/docs/reference/websockets.md

    You can import it directly form `fastapi`:
    
    ```python
    from fastapi import WebSocketDisconnect
    ```
    
    ::: fastapi.WebSocketDisconnect
    
    ## WebSockets - additional classes
    
    Additional classes for handling WebSockets.
    
    Provided directly by Starlette, but you can import it from `fastapi`:
    
    ```python
    from fastapi.websockets import WebSocketDisconnect, WebSocketState
    ```
    
    ::: fastapi.websockets.WebSocketDisconnect
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.6K bytes
    - Viewed (0)
Back to top