ircstore

Persistent IRC log storage with S2 compression and real-time WebSocket streaming.

What is ircstore?

ircstore is a high-performance IRC logging system that:

REST API

GET /api/channels

List all available IRC channels

curl https://ircstore.rotko.net/api/channels

Response:

["#rust", "#linux", "#networking"]
GET /api/logs/:channel

Retrieve historical logs for a specific channel

Query parameters:

curl "https://ircstore.rotko.net/api/logs/%23rust?limit=50&offset=0"

Response:

[
  {
    "timestamp": 1698765432,
    "channel": "#rust",
    "nick": "alice",
    "message": "anyone familiar with async traits?"
  }
]

WebSocket API

WS /ws

Subscribe to real-time IRC messages across all channels

const ws = new WebSocket('wss://ircstore.rotko.net/ws');

ws.onmessage = (event) => {
    const msg = JSON.parse(event.data);
    console.log(`[${msg.channel}] ${msg.nick}: ${msg.message}`);
};

Message format:

{
  "timestamp": 1698765432,
  "channel": "#rust",
  "nick": "alice",
  "message": "anyone familiar with async traits?"
}

Example: Python Client

import requests
import websocket
import json

# Get available channels
channels = requests.get('https://ircstore.rotko.net/api/channels').json()
print(f"Available channels: {channels}")

# Get recent logs
logs = requests.get('https://ircstore.rotko.net/api/logs/%23rust?limit=10').json()
for msg in logs:
    print(f"[{msg['nick']}] {msg['message']}")

# Subscribe to real-time updates
def on_message(ws, message):
    msg = json.loads(message)
    print(f"[{msg['channel']}] {msg['nick']}: {msg['message']}")

ws = websocket.WebSocketApp('wss://ircstore.rotko.net/ws', on_message=on_message)
ws.run_forever()

Example: JavaScript Client

// Fetch historical logs
async function getLogs(channel, limit = 100) {
    const res = await fetch(`/api/logs/${encodeURIComponent(channel)}?limit=${limit}`);
    return await res.json();
}

// Real-time subscription
const ws = new WebSocket('wss://ircstore.rotko.net/ws');
const messageHandlers = new Map();

ws.onmessage = (event) => {
    const msg = JSON.parse(event.data);
    const handler = messageHandlers.get(msg.channel);
    if (handler) handler(msg);
};

// Subscribe to specific channel
function subscribeToChannel(channel, callback) {
    messageHandlers.set(channel, callback);
}

subscribeToChannel('#rust', (msg) => {
    console.log(`${msg.nick}: ${msg.message}`);
});

Data Format

IrcEvent Structure

interface IrcEvent {
    timestamp: number;  // Unix timestamp
    channel: string;    // IRC channel name
    nick: string;       // Sender nickname
    message: string;    // Message content
}

Implementation Details

Source Code

The project is open source and available at github.com/rotkonetworks/ircstore