Real-time AI communication ยท ws://localhost:3210/ws

๐Ÿ’ฌ Live Chat ยท via WebSocket Disconnected
Connect and start chatting with AI โšก

โšก Connect

Persistent connection โ€” send multiple messages without reconnecting.

// JavaScript
const ws = new WebSocket("ws://localhost:3210/ws");

ws.onopen = () => console.log("Connected!");
ws.onmessage = (e) => console.log(JSON.parse(e.data));

// Send a message
ws.send(JSON.stringify({
    action: "ask",
    model: "claude",
    message: "What is AI?"
}));
๐Ÿ“‹ Available Actions
ask LIVE
Chat with any AI provider
search
Web search via Perplexity
code
Generate / review / explain code
translate
Translate text
brainstorm
Creative ideas
debate
Multi-provider debate
audit
Security vulnerability scan
ping
Connection health check
stats
Server statistics
๐Ÿ“จ Message Format

โ†’ Send (Client to Server)

{
  "action": "ask",
  "model": "claude",
  "message": "What is AI?",
  "id": "optional-request-id"
}

โ† Receive (Server to Client)

// Status update
{"type":"status","id":"req_1","status":"processing"}

// Response
{"type":"response","id":"req_1",
 "content":"AI is...",
 "model":"claude",
 "responseTimeMs":5420}

// Error
{"type":"error","id":"req_1",
 "error":"Provider unavailable"}
๐Ÿ“ All Actions โ€” Examples

๐Ÿ’ฌ Ask / Chat

// Ask specific provider
{"action":"ask","model":"claude",
 "message":"Write a haiku"}

// Auto-pick best
{"action":"ask",
 "message":"Hello world"}

๐Ÿ” Search

{"action":"search",
 "query":"Latest AI news 2026"}

๐Ÿ’ป Code

// Generate
{"action":"code",
 "description":"Sort algorithm",
 "language":"Python"}

// Review
{"action":"code","subaction":"review",
 "description":"def fib(n):..."}

๐ŸŒ Translate

{"action":"translate",
 "text":"Hello world",
 "to":"Hindi"}

๐Ÿง  Brainstorm

{"action":"brainstorm",
 "topic":"AI startup ideas"}

โš”๏ธ Debate

{"action":"debate",
 "topic":"Is AI dangerous?"}

๐Ÿ›ก๏ธ Security Audit

{"action":"audit",
 "code":"app.get('/user',
  (req,res)=>db.query(
  'SELECT * WHERE id='+req.id))"}

โค๏ธ Ping / Stats

{"action":"ping"}
// โ†’ {"type":"pong"}

{"action":"stats"}
// โ†’ {"type":"stats","data":{...}}
๐Ÿ”ง Client Examples

JavaScript (Browser / Node.js)

const ws = new WebSocket("ws://localhost:3210/ws");

ws.onmessage = (e) => {
  const msg = JSON.parse(e.data);
  if (msg.type === 'response') {
    console.log(msg.content);
  }
};

ws.onopen = () => {
  ws.send(JSON.stringify({
    action: "ask",
    model: "claude",
    message: "Explain AI"
  }));
};

Python

import websocket, json

ws = websocket.create_connection(
  "ws://localhost:3210/ws"
)

# Send
ws.send(json.dumps({
  "action": "ask",
  "model": "claude",
  "message": "What is AI?"
}))

# Receive
result = json.loads(ws.recv())  # status
result = json.loads(ws.recv())  # response
print(result["content"])
๐Ÿ“ก Event Types
connected
Initial connection โ€” returns clientId
status
Processing status update (processing, searching, etc.)
response
AI response with content and timing
error
Error with message
pong
Reply to ping
stats
Server statistics data
Proxima WebSocket v4.1.0 โ€” Zen4-bit โšก