wifiWebSocket API

Real-time bidirectional messaging for custom clients and apps.

Connect to the WebSocket endpoint for low-latency message exchange.

Use wss://your-host/ws in production, or ws://127.0.0.1:18789 locally.

Message format

All messages are JSON and include a type field.

Send a message

{
  "type": "message",
  "content": "审计这个合约 0x...",
  "channelId": "ws-session-1",
  "userId": "user-123",
  "token": "your-gateway-token"
}

Receive a reply

{
  "type": "reply",
  "content": "合约审计结果:\n风险等级: LOW\n..."
}

Ping and pong

Error message

JavaScript example

Last updated