MCPcopy
hub / github.com/dataelement/Clawith / run

Method run

backend/app/api/websocket.py:272–288  ·  view source on GitHub ↗

Main entry point for handling the lifecycle of the WebSocket connection.

(self)

Source from the content-addressed store, hash-verified

270 self.current_user_text: str = ""
271
272 async def run(self):
273 """Main entry point for handling the lifecycle of the WebSocket connection."""
274 try:
275 # 1. Setup session (Authentication, permissions, loading models, history, etc.)
276 success = await self.setup()
277 if not success:
278 return
279
280 # 2. Start the message receiving and processing loop
281 await self.message_loop()
282
283 except WebSocketDisconnect:
284 logger.info(f"[WS] Client disconnected: {getattr(self.user, 'id', 'unknown')}")
285 await manager.disconnect(str(self.agent_id), self.websocket)
286 except Exception as e:
287 logger.exception(f"[WS] Unexpected error: {e}")
288 await manager.disconnect(str(self.agent_id), self.websocket)
289
290 async def setup(self) -> bool:
291 """Accepts connection, authenticates user, verifies agent access, loads models, resolves session & history."""

Callers 15

websocket_chatFunction · 0.95
seed.pyFile · 0.80
update_schema.pyFile · 0.80
remove_old_tool.pyFile · 0.80
run_migrations_onlineFunction · 0.80
start_containerMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
_kill_portFunction · 0.80

Calls 3

setupMethod · 0.95
message_loopMethod · 0.95
disconnectMethod · 0.80