- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 27 for send_text (0.05 sec)
-
tests/test_tutorial/test_websockets/test_tutorial003.py
def test_websocket_handle_disconnection(client: TestClient): with ( client.websocket_connect("/ws/1234") as connection, client.websocket_connect("/ws/5678") as connection_two, ): connection.send_text("Hello from 1234") data1 = connection.receive_text() assert data1 == "You wrote: Hello from 1234" data2 = connection_two.receive_text() client1_says = "Client #1234 says: Hello from 1234"
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_validation_error_context.py
await websocket.accept() # pragma: no cover await websocket.send_text(f"Item: {item_id}") # pragma: no cover await websocket.close() # pragma: no cover @sub_app.websocket("/ws/{item_id}") async def subapp_websocket_endpoint(websocket: WebSocket, item_id: int): await websocket.accept() # pragma: no cover await websocket.send_text(f"Item: {item_id}") # pragma: no cover await websocket.close() # pragma: no cover
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 06 12:21:57 UTC 2025 - 4.7K bytes - Viewed (0) -
fastapi/exceptions.py
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__( self, code: Annotated[ int, Doc(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 6.8K bytes - Viewed (0) -
docs_src/websockets/tutorial001_py39.py
@app.websocket("/ws") async def websocket_endpoint(websocket: WebSocket): await websocket.accept() while True: data = await websocket.receive_text()
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1.4K bytes - Viewed (0) -
docs/en/docs/reference/websockets.md
- send - accept - receive_text - receive_bytes - receive_json - iter_text - iter_bytes - iter_json - send_text - send_bytes - send_json - close When a client disconnects, a `WebSocketDisconnect` exception is raised, you can catch it. You can import it directly form `fastapi`:Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Aug 06 04:48:30 UTC 2024 - 1.7K bytes - Viewed (0) -
fastapi/routing.py
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) ``` """ def decorator(func: DecoratedCallable) -> DecoratedCallable: self.add_api_websocket_route(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 174.6K bytes - Viewed (0) -
fastapi/applications.py
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: self.add_api_websocket_route( path,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 176.3K bytes - Viewed (0) -
docs_src/generate_clients/tutorial004_py39.py
import json from pathlib import Path file_path = Path("./openapi.json") openapi_content = json.loads(file_path.read_text()) for path_data in openapi_content["paths"].values(): for operation in path_data.values(): tag = operation["tags"][0] operation_id = operation["operationId"] to_remove = f"{tag}-" new_operation_id = operation_id[len(to_remove) :] operation["operationId"] = new_operation_id
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 493 bytes - Viewed (0) -
scripts/docs.py
("'t", "t"), # don't -> dont ("**", ""), # **FastAPI**s -> FastAPIs ], ) def get_en_config() -> dict[str, Any]: return mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8")) def get_lang_paths() -> list[Path]: return sorted(docs_path.iterdir()) def lang_callback(lang: Optional[str]) -> Union[str, None]: if lang is None: return NoneRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Dec 21 17:40:17 UTC 2025 - 16.9K bytes - Viewed (0) -
scripts/topic_repos.py
# Local development # repos_path = Path("../docs/en/data/topic_repos.yml") repos_path = Path("./docs/en/data/topic_repos.yml") repos_old_content = repos_path.read_text(encoding="utf-8") new_repos_content = yaml.dump(data, sort_keys=False, width=200, allow_unicode=True) if repos_old_content == new_repos_content: logging.info("The data hasn't changed. Finishing.") returnRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 16 12:34:01 UTC 2025 - 2.7K bytes - Viewed (0)