WebSocket-to-IRCbridge
A Rust Axum service that bridges WebSocket clients to an Ergo IRC server — adding JWT auth, per-channel Valkey history, rate limiting, and a shared chat schema so web and game clients speak the same vocabulary as the IRC network. Fronts KBVE's /minechat and /gamechat channels.
Per-channel backscroll
A dedicated listener task per channel holds its own IRC connection and appends every PRIVMSG to a 50-message ring (Valkey, or in-process without it), so freshly connected clients see recent history plus live messages.
- Auth — JWT verified before channel access.
- Schema — bevy_chat ChatMessage ⇄ IRC PRIVMSG.
What it gives you
Features
WebSocket ↔ IRC bridge
Proxies WebSocket sessions onto Ergo IRC connections.
JWT auth
Validates tokens before granting channel access.
Per-channel history
A listener task per channel rings recent PRIVMSGs for backscroll.
Rate limiting
Ingress throttling plus an outbound filter (link block, a staff-editable word list, repeat-flood check) before anything reaches ergo.
Shared chat schema
bevy_chat ChatMessage ⇄ IRC PRIVMSG translation.
REST + WebSocket transports
/api/v1 status, channels, users, me, history and a moderator announce endpoint alongside the sockets.
Runtime
Usage & deploy
Built as registry.gitlab.com/kbve/workspace/irc-gateway and deployed on
Kubernetes. Clients connect over WebSocket with a valid JWT:
/ws(also/webirc) proxies raw IRC frames for browser IRC clients./minechatand/gamechatterminate IRC on the server and speakChatMessageJSON, with the channel whitelist, sender and platform pinned server-side.- With
ERGO_JWT_KEYset, a web session logs into its ergo account over SASL, so an always-on client survives a dropped socket.
The chat room itself is served from kbve.com/chat/; the old chat.kbve.com page routes redirect there.
Questions
Frequently asked
What does the IRC Gateway do?
It is a Rust Axum service that bridges WebSocket clients to an Ergo IRC server, adding JWT authentication, per-channel chat history, rate limiting, and a shared chat message schema.
How is chat history handled?
A dedicated listener task per channel holds its own IRC connection and appends every PRIVMSG to a 50-message ring buffer, kept in Valkey when it is configured and in process otherwise, so freshly connected clients can be shown recent backscroll.
What transport and auth does it use?
It exposes WebSocket and REST transports over Axum with JWT verification, and uses the shared bevy_chat schema to translate between ChatMessage and IRC PRIVMSG frames.
Discuss on the forum
Questions, fixes and notes on this page live in the KBVE forum.