Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /farhan0167_otto-m8 /lib /otto_backend /routers /experimental.py
| from pydantic import BaseModel | |
| from fastapi import HTTPException, APIRouter, WebSocket, WebSocketDisconnect | |
| from extensions.experimental import Terminal | |
| router = APIRouter() | |
| async def websocket_endpoint(websocket: WebSocket): | |
| terminal = Terminal() | |
| await websocket.accept() | |
| print("✅ WebSocket connection accepted") | |
| try: | |
| while True: | |
| data = await websocket.receive_text() | |
| response = terminal.run_command(data) | |
| await websocket.send_text(response) # Async sending | |
| except WebSocketDisconnect: | |
| print("❌ Client disconnected", flush=True) | |
| except Exception as e: | |
| print(f"❌ WebSocket Error: {e}", flush=True) | |
| # finally: | |
| # await websocket.close() | |
| # print("❌ WebSocket Closed", flush=True) | |
Xet Storage Details
- Size:
- 825 Bytes
- Xet hash:
- 49c7995ca5da8c7d4df53c068384c6e7e3ad4ee1a2d654a637fcaec7d897db3e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.