This guide covers the programmatic interfaces available for IRC.atl.chat, focusing on the actual JSON-RPC API provided by UnrealIRCd.
IRC.atl.chat provides:
- JSON-RPC API - UnrealIRCd's built-in administration API (port 8600)
- WebSocket IRC - Standard IRC protocol over WebSocket (port 8000)
JSON-RPC API: unrealircd:8600 (internal)
WebSocket IRC: unrealircd:8000 (external)
The JSON-RPC API is built into UnrealIRCd and provides server administration capabilities.
# Test RPC connectivity
curl -X POST http://localhost:8600/api \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "server.info",
"params": {},
"id": 1
}'The RPC API uses basic authentication configured in UnrealIRCd:
// In unrealircd.conf
rpc-user adminpanel {
match { ip 127.*; }
rpc-class full;
password "your_rpc_password";
}UnrealIRCd's JSON-RPC API provides these core methods:
server.info- Get server informationserver.stats- Get server statisticsserver.command- Execute server commands
user.list- List online usersuser.get- Get user detailsuser.action- Perform user actions (kill, ban, etc.)
channel.list- List channelschannel.get- Get channel detailschannel.action- Perform channel actions
ban.list- List active bansban.add- Add new banban.remove- Remove ban
curl -X POST http://localhost:8600/api \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "server.info",
"params": {},
"id": 1
}'curl -X POST http://localhost:8600/api \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "user.list",
"params": {"limit": 50},
"id": 2
}'curl -X POST http://localhost:8600/api \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "server.command",
"params": {
"command": "REHASH"
},
"id": 3
}'WebSocket IRC provides standard IRC protocol over WebSocket connections.
const ws = new WebSocket('ws://localhost:8000');
ws.onopen = function() {
// Send IRC registration
ws.send('NICK mynick\r\n');
ws.send('USER mynick 0 * :Real Name\r\n');
};
ws.onmessage = function(event) {
console.log('Received:', event.data);
// Handle IRC messages
};import websocket
def on_message(ws, message):
print(f"Received: {message}")
def on_open(ws):
ws.send('NICK mynick\r\n')
ws.send('USER mynick 0 * :Real Name\r\n')
ws = websocket.WebSocketApp('ws://localhost:8000',
on_message=on_message,
on_open=on_open)
ws.run_forever()WebSocket connections use standard IRC protocol:
NICK mynick
USER mynick 0 * :Real Name
JOIN #channel
PRIVMSG #channel :Hello world!
PART #channel
PING :server
PONG :server
Configure the JSON-RPC API in unrealircd.conf:
// Enable RPC modules
include "rpc.modules.default.conf";
// Listen on RPC port
listen {
ip *;
port 8600;
options { rpc; }
}
// RPC user configuration
rpc-user adminpanel {
match { ip 127.*; }
rpc-class full;
password "secure_password";
}WebSocket IRC is enabled by default in UnrealIRCd 6.x:
// WebSocket listener
listen {
ip *;
port 8000;
options { websocket; }
}Cannot connect to RPC API:
-
Check if RPC is enabled:
grep -A5 "listen.*rpc" src/backend/unrealircd/conf/unrealircd.conf -
Verify RPC user configuration:
grep -A5 "rpc-user" src/backend/unrealircd/conf/unrealircd.conf -
Test connectivity:
curl -v http://localhost:8600/api
WebSocket connection fails:
-
Check WebSocket listener:
grep -A5 "websocket" src/backend/unrealircd/conf/unrealircd.conf -
Test WebSocket connection:
curl -i -N -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" \ -H "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==" \ http://localhost:8000/
- Authentication: Always use strong RPC passwords
- Access Control: Limit RPC access to trusted IPs
- HTTPS: Use HTTPS for RPC connections in production
- TLS: Use WSS (WebSocket Secure) in production
- Origin Validation: Validate WebSocket origins
- Rate Limiting: Implement connection rate limiting
- UNREALIRCD.md - IRC server configuration
- WEBPANEL.md - Web administration interface
- CONFIG.md - Configuration management
- TROUBLESHOOTING.md - Common issues and solutions