Socket.IO Real-time Connection
curl --request GET \
--url http://localhost:3000/websocketimport requests
url = "http://localhost:3000/websocket"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://localhost:3000/websocket', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/websocket",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/websocket"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/websocket")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/websocket")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyWEBSOCKET
Socket.IO Real-time Connection
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": {} }
GET
/
websocket
Socket.IO Real-time Connection
curl --request GET \
--url http://localhost:3000/websocketimport requests
url = "http://localhost:3000/websocket"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://localhost:3000/websocket', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/websocket",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/websocket"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:3000/websocket")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/websocket")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyResponse
101
Switching Protocols - WebSocket connection established
Was this page helpful?

