Skip to content

implement simple websocket chat#3

Open
PAY2109 wants to merge 3 commits into
mainfrom
feature/asi-create-channel
Open

implement simple websocket chat#3
PAY2109 wants to merge 3 commits into
mainfrom
feature/asi-create-channel

Conversation

@PAY2109
Copy link
Copy Markdown
Collaborator

@PAY2109 PAY2109 commented May 26, 2026

Description

Adds a WebSocket-based chat channel for OmegaClaw so it can talk to a web chat backend through a small JSON protocol.

This change:

  • adds a new channels/wschat.py adapter
  • supports optional bearer auth via WS_TOKEN
  • handles reconnects with backoff, resume via last_seen_seq, inbound deduplication, and outbound buffering while disconnected
  • wires commchannel=websocket into the MeTTa channel dispatch
  • extends scripts/omegaclaw bootstrap/start flow to collect and pass WS_URL / WS_TOKEN
  • adds the websockets dependency to the runtime and Docker image

Issue fixed: OmegaClaw can now be integrated with a WebSocket chat service without relying on IRC, Telegram, or Slack.

How Has This Been Tested?

Manual test scenarios:

  1. Run scripts/omegaclaw, select WebSocket Chat, provide a valid ws:// or wss:// URL, and confirm the container starts with commchannel=websocket.
  2. Connect OmegaClaw to a test WebSocket server and send:
    {"type":"user_message","seq":1,"text":"hello"}
    Verify the message is received and processed by the agent.
  3. Verify agent replies are sent back as agent_message JSON frames with client_seq and text.
  4. Drop the WebSocket connection and confirm the client reconnects automatically.
  5. After reconnect, verify the client sends a resume frame with last_seen_seq and missed user_message frames are replayed once without duplication.
  6. Send a reply while the socket is disconnected and confirm it is buffered and flushed after reconnect.
  7. If WS_TOKEN is configured, verify the connection includes Authorization: Bearer <token>.

Checklist

  • The code generated by LLM is reviewed by the PR creator
  • Self-review completed
  • Test scenarios above are passed with the version of the code from PR

@PAY2109 PAY2109 requested a review from sassless May 26, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants