Replace polling with WebSocket for real-time Signal message reception

Switch from polling /v1/receive every 2s to a persistent WebSocket
connection at ws://.../v1/receive/<number>. Messages now arrive
instantly via the signal-cli-rest-api WebSocket endpoint.

- Add `listen()` generator to SignalClient using websockets library
- Extract `_parse_envelope()` as standalone function
- Replace `run_loop` polling with WebSocket listener + reconnect logic
- Remove `poll_interval` from BotConfig and CLI args
- Add websockets to Nix overlay and pyproject.toml dependencies

https://claude.ai/code/session_01AKXQBuVBsW7J1YbukDiQ7A
This commit is contained in:
Claude
2026-03-08 20:34:29 +00:00
committed by Richie Cahill
parent f4f33eacc4
commit 42ede19472
5 changed files with 53 additions and 37 deletions

View File

@@ -82,5 +82,4 @@ class BotConfig(BaseModel):
signal_api_url: str
phone_number: str
llm: LLMConfig
poll_interval: int = 2
inventory_file: str = "van_inventory.json"