Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for WebSocketException (0.34 sec)

  1. fastapi/__init__.py

    from .background import BackgroundTasks as BackgroundTasks
    from .datastructures import UploadFile as UploadFile
    from .exceptions import HTTPException as HTTPException
    from .exceptions import WebSocketException as WebSocketException
    from .param_functions import Body as Body
    from .param_functions import Cookie as Cookie
    from .param_functions import Depends as Depends
    from .param_functions import File as File
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 15:19:50 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  2. fastapi/exceptions.py

            WebSocket,
            WebSocketException,
            status,
        )
    
        app = FastAPI()
    
        @app.websocket("/items/{item_id}/ws")
        async def websocket_endpoint(
            *,
            websocket: WebSocket,
            session: Annotated[str | None, Cookie()] = None,
            item_id: str,
        ):
            if session is None:
                raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 6.8K bytes
    - Viewed (0)
  3. docs_src/websockets/tutorial002_py39.py

    from typing import Union
    
    from fastapi import (
        Cookie,
        Depends,
        FastAPI,
        Query,
        WebSocket,
        WebSocketException,
        status,
    )
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    html = """
    <!DOCTYPE html>
    <html>
        <head>
            <title>Chat</title>
        </head>
        <body>
            <h1>WebSocket Chat</h1>
            <form action="" onsubmit="sendMessage(event)">
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 2.8K bytes
    - Viewed (0)
  4. docs/pt/docs/advanced/websockets.md

    {* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
    
    /// info | Informação
    
    Como isso é um WebSocket, não faz muito sentido levantar uma `HTTPException`, em vez disso levantamos uma `WebSocketException`.
    
    Você pode usar um código de fechamento dos <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">códigos válidos definidos na especificação</a>.
    
    ///
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 6K bytes
    - Viewed (0)
  5. docs/es/docs/advanced/websockets.md

    {* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
    
    /// info | Información
    
    Como esto es un WebSocket no tiene mucho sentido lanzar un `HTTPException`, en su lugar lanzamos un `WebSocketException`.
    
    Puedes usar un código de cierre de los <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">códigos válidos definidos en la especificación</a>.
    
    ///
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 5.9K bytes
    - Viewed (0)
  6. docs/de/docs/advanced/websockets.md

    {* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
    
    /// info | Info
    
    Da es sich um einen WebSocket handelt, macht es keinen Sinn, eine `HTTPException` auszulösen, stattdessen lösen wir eine `WebSocketException` aus.
    
    Sie können einen „Closing“-Code verwenden, aus den <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">gültigen Codes, die in der Spezifikation definiert sind</a>.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 6.5K bytes
    - Viewed (0)
  7. docs/ru/docs/advanced/websockets.md

    {* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
    
    /// info | Примечание
    
    В веб-сокете вызывать `HTTPException` не имеет смысла. Вместо этого нужно использовать `WebSocketException`.
    
    Закрывающий статус код можно использовать из <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">valid codes defined in the specification</a>.
    
    ///
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 8.6K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/websockets.md

    {* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
    
    /// info
    
    As this is a WebSocket it doesn't really make sense to raise an `HTTPException`, instead we raise a `WebSocketException`.
    
    You can use a closing code from the <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">valid codes defined in the specification</a>.
    
    ///
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 5.7K bytes
    - Viewed (0)
  9. docs/en/docs/release-notes.md

    * New [WebSocketException (and docs)](https://fastapi.tiangolo.com/advanced/websockets/#using-depends-and-others), re-exported from Starlette.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
Back to top