mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-05 07:10:44 +00:00
WebSocket merge
This commit is contained in:
parent
6ca84022d8
commit
4932e12546
124 changed files with 12072 additions and 757 deletions
19
python/websocket_handlers/hello_handler.py
Normal file
19
python/websocket_handlers/hello_handler.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from python.helpers.print_style import PrintStyle
|
||||
from python.helpers.websocket import WebSocketHandler
|
||||
|
||||
|
||||
class HelloHandler(WebSocketHandler):
|
||||
"""Sample handler used for foundational testing."""
|
||||
|
||||
@classmethod
|
||||
def get_event_types(cls) -> list[str]:
|
||||
return ["hello_request"]
|
||||
|
||||
async def process_event(self, event_type: str, data: dict, sid: str):
|
||||
name = data.get("name") or "stranger"
|
||||
PrintStyle.info(f"hello_request from {sid} ({name})")
|
||||
return {"message": f"Hello, {name}!", "handler": self.identifier}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue