- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 114 for webSocket (0.08 seconds)
-
okhttp/src/commonJvmAndroid/kotlin/okhttp3/WebSocket.kt
* limitations under the License. */ package okhttp3 import okio.ByteString /** * A non-blocking interface to a web socket. Use the [factory][WebSocket.Factory] to create * instances; usually this is [OkHttpClient]. * * ## Web Socket Lifecycle * * Upon normal operation each web socket progresses through a sequence of states: *
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Tue Mar 10 21:45:14 GMT 2026 - 6.1K bytes - Click Count (0) -
docs/zh-hant/docs/advanced/testing-websockets.md
# 測試 WebSocket { #testing-websockets } 你可以使用相同的 `TestClient` 來測試 WebSocket。 為此,你可以在 `with` 陳述式中使用 `TestClient`,連線到該 WebSocket: {* ../../docs_src/app_testing/tutorial002_py310.py hl[27:31] *} /// note | 注意 想了解更多,請參考 Starlette 的[測試 WebSocket](https://www.starlette.dev/testclient/#testing-websocket-sessions)文件。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 420 bytes - Click Count (0) -
docs_src/websockets_/tutorial001_py310.py
</body> </html> """ @app.get("/") async def get(): return HTMLResponse(html) @app.websocket("/ws") async def websocket_endpoint(websocket: WebSocket): await websocket.accept() while True: data = await websocket.receive_text()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 12:34:37 GMT 2026 - 1.4K bytes - Click Count (0) -
docs/en/docs/advanced/websockets.md
# WebSockets { #websockets } You can use [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) with **FastAPI**. ## Install `websockets` { #install-websockets } Make sure you create a [virtual environment](../virtual-environments.md), activate it, and install `websockets` (a Python library that makes it easy to use the "WebSocket" protocol): <div class="termy"> ```console $ pip install websockets ---> 100% ```Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Mar 07 09:29:03 GMT 2026 - 5.3K bytes - Click Count (0) -
fastapi/exceptions.py
from fastapi import ( Cookie, FastAPI, 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:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 11 18:41:21 GMT 2026 - 7.3K bytes - Click Count (0) -
docs/zh-hant/docs/advanced/websockets.md
# WebSockets { #websockets } 你可以在 **FastAPI** 中使用 [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)。 ## 安裝 `websockets` { #install-websockets } 請先建立[虛擬環境](../virtual-environments.md)、啟用它,然後安裝 `websockets`(一個讓你更容易使用「WebSocket」通訊協定的 Python 套件): <div class="termy"> ```console $ pip install websockets ---> 100% ``` </div> ## WebSockets 用戶端 { #websockets-client }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 5.2K bytes - Click Count (0) -
fastapi/exception_handlers.py
status_code=422, content={"detail": jsonable_encoder(exc.errors())}, ) async def websocket_request_validation_exception_handler( websocket: WebSocket, exc: WebSocketRequestValidationError ) -> None: await websocket.close( code=WS_1008_POLICY_VIOLATION, reason=jsonable_encoder(exc.errors())Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Sep 16 17:21:48 GMT 2025 - 1.2K bytes - Click Count (0) -
docs_src/app_testing/tutorial002_py310.py
from fastapi.testclient import TestClient from fastapi.websockets import WebSocket app = FastAPI() @app.get("/") async def read_main(): return {"msg": "Hello World"} @app.websocket("/ws") async def websocket(websocket: WebSocket): await websocket.accept() await websocket.send_json({"msg": "Hello WebSocket"}) await websocket.close() def test_read_main(): client = TestClient(app)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 757 bytes - Click Count (0) -
docs_src/websockets_/tutorial003_py310.py
self.active_connections: list[WebSocket] = [] async def connect(self, websocket: WebSocket): await websocket.accept() self.active_connections.append(websocket) def disconnect(self, websocket: WebSocket): self.active_connections.remove(websocket) async def send_personal_message(self, message: str, websocket: WebSocket): await websocket.send_text(message)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 12:34:37 GMT 2026 - 2.5K bytes - Click Count (0) -
docs/zh/docs/advanced/websockets.md
# WebSockets { #websockets } 您可以在 **FastAPI** 中使用 [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)。 ## 安装 `websockets` { #install-websockets } 请确保您创建一个[虚拟环境](../virtual-environments.md)、激活它,并安装 `websockets`(一个让使用“WebSocket”协议更容易的 Python 库): <div class="termy"> ```console $ pip install websockets ---> 100% ``` </div> ## WebSockets 客户端 { #websockets-client }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 5.4K bytes - Click Count (0)