Skip to main content
Version: 1.0.10

Socket.IO Real-time Connection

GET 

/websocket

Socket.IO connection for real-time bidirectional communication. The server uses Socket.IO v4.x for WebSocket transport with automatic fallback.

Connection URL: ws://localhost:3000/socket.io/ (or wss:// for secure connections)

Socket.IO Client Connection Example:

import { io } from 'socket.io-client';
const socket = io('http://localhost:3000');

Events:

Client to Server Events:

  • join - Join a room/channel

    \{
    "roomId": "uuid",
    "agentId": "uuid"
    \}
  • leave - Leave a room/channel

    \{
    "roomId": "uuid",
    "agentId": "uuid"
    \}
  • message - Send a message

    \{
    "text": "string",
    "roomId": "uuid",
    "userId": "uuid",
    "name": "string"
    \}
  • request-world-state - Request current state

    \{
    "roomId": "uuid"
    \}

Server to Client Events:

  • messageBroadcast - New message broadcast

    \{
    "senderId": "uuid",
    "senderName": "string",
    "text": "string",
    "roomId": "uuid",
    "serverId": "uuid",
    "createdAt": "timestamp",
    "source": "string",
    "id": "uuid",
    "thought": "string",
    "actions": ["string"],
    "attachments": []
    \}
  • messageComplete - Message processing complete

    \{
    "channelId": "uuid",
    "serverId": "uuid"
    \}
  • world-state - World state update

    \{
    "agents": \{\},
    "users": \{\},
    "channels": \{\},
    "messages": \{\}
    \}
  • logEntry - Real-time log entry

    \{
    "level": "number",
    "time": "timestamp",
    "msg": "string",
    "agentId": "uuid",
    "agentName": "string"
    \}
  • error - Error event

    \{
    "error": "string",
    "details": \{\}
    \}

Responses

Switching Protocols - WebSocket connection established