- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 128 for WebSocket (0.12 sec)
-
tests/test_ws_router.py
@router.websocket("/router2") async def routerindex2(websocket: WebSocket): await websocket.accept() await websocket.send_text("Hello, router!") await websocket.close() @router.websocket("/router/{pathparam:path}") async def routerindexparams(websocket: WebSocket, pathparam: str, queryparam: str): await websocket.accept() await websocket.send_text(pathparam) await websocket.send_text(queryparam)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jun 11 19:08:14 UTC 2023 - 7.5K bytes - Viewed (0) -
docs_src/app_testing/tutorial002.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)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Feb 08 10:23:07 UTC 2023 - 757 bytes - Viewed (0) -
tests/test_ws_dependencies.py
@app.websocket("/", dependencies=[create_dependency("index")]) async def index(websocket: WebSocket, deps: DepList): await websocket.accept() await websocket.send_text(json.dumps(deps)) await websocket.close() @router.websocket("/router", dependencies=[create_dependency("routerindex")]) async def routerindex(websocket: WebSocket, deps: DepList): await websocket.accept()
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jun 11 20:35:39 UTC 2023 - 2.1K bytes - Viewed (0) -
samples/slack/src/main/java/okhttp3/slack/RtmSession.java
@Override public void onMessage(WebSocket webSocket, String text) { System.out.println("onMessage: " + text); } @Override public void onClosing(WebSocket webSocket, int code, String reason) { webSocket.close(1000, null); System.out.println("onClose (" + code + "): " + reason); } @Override public void onFailure(WebSocket webSocket, Throwable t, Response response) {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Nov 19 20:16:58 UTC 2016 - 2.4K bytes - Viewed (0) -
tests/test_tutorial/test_websockets/test_tutorial002_an_py39.py
message = "Message one" websocket.send_text(message) data = websocket.receive_text() assert data == "Session cookie or query token value is: some-token" data = websocket.receive_text() assert data == f"Message text was: {message}, for item ID: bar" message = "Message two" websocket.send_text(message)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 3.9K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/WebSocketEcho.java
client.dispatcher().executorService().shutdown(); } @Override public void onOpen(WebSocket webSocket, Response response) { webSocket.send("Hello..."); webSocket.send("...World!"); webSocket.send(ByteString.decodeHex("deadbeef")); webSocket.close(1000, "Goodbye, World!"); } @Override public void onMessage(WebSocket webSocket, String text) { System.out.println("MESSAGE: " + text); }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Thu Apr 04 11:40:21 UTC 2024 - 1.6K bytes - Viewed (0) -
tests/test_route_scope.py
route: APIWebSocketRoute = websocket.scope["route"] await websocket.accept() await websocket.send_json({"item_id": item_id, "path": route.path}) client = TestClient(app) def test_get(): response = client.get("/users/rick") assert response.status_code == 200, response.text assert response.json() == {"user_id": "rick", "path": "/users/{user_id}"}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Feb 08 10:23:07 UTC 2023 - 1.5K bytes - Viewed (0) -
okhttp/src/main/kotlin/okhttp3/WebSocketListener.kt
* messages. */ open fun onOpen( webSocket: WebSocket, response: Response, ) { } /** Invoked when a text (type `0x1`) message has been received. */ open fun onMessage( webSocket: WebSocket, text: String, ) { } /** Invoked when a binary (type `0x2`) message has been received. */ open fun onMessage( webSocket: WebSocket, bytes: ByteString, ) { } /**
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 2K bytes - Viewed (0) -
docs_src/websockets/tutorial001.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()
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 1.4K bytes - Viewed (0) -
docs/de/docs/advanced/websockets.md
{!../../docs_src/websockets/tutorial001.py!} ``` ## Einen `websocket` erstellen Erstellen Sie in Ihrer **FastAPI**-Anwendung einen `websocket`: ```Python hl_lines="1 46-47" {!../../docs_src/websockets/tutorial001.py!} ``` /// note | "Technische Details" Sie können auch `from starlette.websockets import WebSocket` verwenden.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.9K bytes - Viewed (0)