Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for receive_text (0.4 sec)

  1. docs/en/docs/reference/websockets.md

                - client
                - state
                - url_for
                - client_state
                - application_state
                - receive
                - send
                - accept
                - receive_text
                - receive_bytes
                - receive_json
                - iter_text
                - iter_bytes
                - iter_json
                - send_text
                - send_bytes
                - send_json
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 04:48:30 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  2. fastapi/exceptions.py

        ):
            if session is None:
                raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
            await websocket.accept()
            while True:
                data = await websocket.receive_text()
                await websocket.send_text(f"Session cookie is: {session}")
                await websocket.send_text(f"Message text was: {data}, for item ID: {item_id}")
        ```
        """
    
        def __init__(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Apr 02 02:48:51 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  3. docs/de/docs/advanced/websockets.md

    <img src="/img/tutorial/websockets/image05.png">
    
    ## Verbindungsabbrüche und mehreren Clients handhaben
    
    Wenn eine WebSocket-Verbindung geschlossen wird, löst `await websocket.receive_text()` eine `WebSocketDisconnect`-Exception aus, die Sie dann wie in folgendem Beispiel abfangen und behandeln können.
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="79-81"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.9K bytes
    - Viewed (0)
  4. docs/em/docs/advanced/websockets.md

    👀 👈 🔢 `token` 🔜 🍵 🔗.
    
    ///
    
    ⏮️ 👈 👆 💪 🔗 *️⃣ &amp; ⤴️ 📨 &amp; 📨 📧:
    
    <img src="/img/tutorial/websockets/image05.png">
    
    ## 🚚 🔀 &amp; 💗 👩‍💻
    
    🕐❔ *️⃣ 🔗 📪, `await websocket.receive_text()` 🔜 🤚 `WebSocketDisconnect` ⚠, ❔ 👆 💪 ⤴️ ✊ &amp; 🍵 💖 👉 🖼.
    
    ```Python hl_lines="81-83"
    {!../../docs_src/websockets/tutorial003.py!}
    ```
    
    🔄 ⚫️ 👅:
    
    * 📂 📱 ⏮️ 📚 🖥 📑.
    * ✍ 📧 ⚪️➡️ 👫.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  5. docs/pt/docs/advanced/websockets.md

    <img src="/img/tutorial/websockets/image05.png">
    
    ## Lidando com desconexões e múltiplos clientes
    
    Quando uma conexão WebSocket é fechada, o `await websocket.receive_text()` levantará uma exceção `WebSocketDisconnect`, que você pode então capturar e lidar como neste exemplo.
    
    {*../../docs_src/websockets/tutorial003_py39.py hl[79:81]*}
    
    Para testar:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Oct 31 12:20:59 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/websockets.md

    <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.
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="79-81"
    {!> ../../docs_src/websockets/tutorial003_py39.py!}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  7. docs/zh/docs/advanced/websockets.md

    /// tip
    
    注意,查询参数 `token` 将由依赖项处理。
    
    ///
    
    通过这样,您可以连接 WebSocket,然后发送和接收消息:
    
    <img src="/img/tutorial/websockets/image05.png">
    
    ## 处理断开连接和多个客户端
    
    当 WebSocket 连接关闭时,`await websocket.receive_text()` 将引发 `WebSocketDisconnect` 异常,您可以捕获并处理该异常,就像本示例中的示例一样。
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="79-81"
    {!> ../../docs_src/websockets/tutorial003_py39.py!}
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  8. docs/ja/docs/advanced/websockets.md

    クエリ `token` は依存パッケージによって処理されることに注意してください。
    
    ///
    
    これにより、WebSocketに接続してメッセージを送受信できます。
    
    <img src="/img/tutorial/websockets/image05.png">
    
    ## 切断や複数クライアントへの対応
    
    WebSocket接続が閉じられると、 `await websocket.receive_text()` は例外 `WebSocketDisconnect` を発生させ、この例のようにキャッチして処理することができます。
    
    ```Python hl_lines="81-83"
    {!../../docs_src/websockets/tutorial003.py!}
    ```
    
    試してみるには、
    
    * いくつかのブラウザタブでアプリを開きます。
    * それらのタブでメッセージを記入してください。
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  9. fastapi/routing.py

            @router.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}")
    
            app.include_router(router)
            ```
            """
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Oct 12 09:44:57 UTC 2024
    - 172.1K bytes
    - Viewed (0)
  10. fastapi/applications.py

            @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}")
            ```
            """
    
            def decorator(func: DecoratedCallable) -> DecoratedCallable:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:52:31 UTC 2024
    - 172.2K bytes
    - Viewed (0)
Back to top