Skip to content

WebSocket Protocol

RsClaw implements the OpenClaw WebSocket v3 protocol with 33+ methods. Compatible with the OpenClaw Control Panel (WebUI).

Connection

ws://localhost:18888/ws

Message Format

All messages are JSON:

json
{
  "type": "method_name",
  "data": { ... }
}

Methods

Session Management

MethodDirectionDescription
chatClient -> ServerSend a chat message
chat_streamServer -> ClientStreaming response chunks
chat_endServer -> ClientEnd of response
clear_sessionClient -> ServerClear current session
get_sessionsClient -> ServerList all sessions
get_historyClient -> ServerGet session message history
delete_sessionClient -> ServerDelete a session

Device & Pairing

MethodDirectionDescription
register_deviceClient -> ServerRegister a new device
pairClient -> ServerSubmit pairing code
get_devicesClient -> ServerList paired devices
revoke_deviceClient -> ServerRevoke a paired device

Configuration

MethodDirectionDescription
get_configClient -> ServerGet current configuration
update_configClient -> ServerUpdate configuration
get_modelsClient -> ServerList available models
set_modelClient -> ServerChange active model

Status

MethodDirectionDescription
get_statusClient -> ServerGateway status
get_channelsClient -> ServerConnected channels
healthClient -> ServerHealth check

Agent Control

MethodDirectionDescription
spawn_agentClient -> ServerSpawn a sub-agent
list_agentsClient -> ServerList running agents
kill_agentClient -> ServerTerminate an agent

Streaming Example

javascript
const ws = new WebSocket('ws://localhost:18888/ws');

ws.onopen = () => {
  ws.send(JSON.stringify({
    type: 'chat',
    data: {
      message: 'Hello!',
      session_id: 'my-session',
      stream: true,
    }
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  switch (msg.type) {
    case 'chat_stream':
      process.stdout.write(msg.data.content);
      break;
    case 'chat_end':
      console.log('\n[Done]');
      break;
  }
};

Released under MIT / Apache-2.0 License