Chat for WebIRC
This plugin provides a shortcode that renders a lightweight IRC client written in vanilla JavaScript. It supports direct WebSocket connections to IRC servers (IRCv3-friendly) and includes an optional WebIRC gateway.
Security-conscious defaults:
- Server allow-list (host:port format), WSS (WebSockets over SSL/TLS) only
- Optional WebSocket subprotocols (e.g.,
text.ircv3.net) - Optional WS path (e.g.,
/webirc) - Optional CSP connect-src helper (off by default)
- Input sanitization and validation
- Proper escaping of output
Features:
- Image Sharing: Upload and share images directly in chat with drag-and-drop support
- Custom Avatars: Personalized user avatars with upload, crop, and preview functionality
- Smart Image Processing: Automatic optimization, resizing, and format conversion (WebP support)
- Performance Optimized: Memory-efficient processing with caching and lazy loading
- Mobile-First Images: Touch-friendly upload interface with responsive image display
- Modern Responsive Design: Mobile-first approach with adaptive layouts for all screen sizes
- Enhanced Mobile Experience: Touch-optimized interface with proper virtual keyboard support
- Smart Responsive Behavior: Overlay sidebar on mobile, collapsible on tablet, side-by-side on desktop
- Editable Username: Click-to-edit nickname with real-time validation and user persistence
- User Persistence: Automatic nickname saving for logged-in WordPress users
- Lightweight vanilla TypeScript/JavaScript implementation (no frameworks)
- Fully responsive design with semantic HTML
- Internationalization ready (i18n strings)
- Configurable server allow-list with strict validation
- WebSocket subprotocol support (IRCv3)
- Optional WebIRC gateway fallback
- Comprehensive IRC slash commands: 30+ commands including /join, /part, /nick, /msg, /whois, /topic, /away, /help, and more
- Automatic nickname generation and collision handling
- Debug logging and connection status indicators
- Optional Content Security Policy (CSP) header generation
- WordPress hooks and filters for extensibility
- Follows WordPress Coding Standards
Usage
Basic Usage:
Simply add the shortcode [chat_webirc] to any page or post where you want the IRC chat to appear. The plugin will use secure default settings to connect to a test IRC server.
Shortcode Examples:
* Basic: [chat_webirc] – Uses default server and channel
* Custom channel: [chat_webirc channel="#mychannel"]
* Custom server: [chat_webirc server="irc.example.com:7443" channel="#general"]
Available IRC Commands: Once the chat is loaded, users can use these commands:
Basic Commands:
* /join #channel – Join a channel
* /part [#channel] – Leave current or specified channel
* /nick newname – Change nickname
* /quit [message] – Disconnect
* /help – Show all available commands
Communication:
* /msg <nick> <message> – Send private message
* /notice <target> <message> – Send notice message
* /me <action> – Send action message
* /query <nick> – Open private chat context
User & Channel Info:
* /whois <nick> – Get detailed user information
* /who [channel] – List users in channel
* /list [pattern] – List available channels
* /names [channel] – List nicknames in channel
* /topic [text] – View/set channel topic
Status & Utility:
* /away [message] – Set away status
* /back – Remove away status
* /ping <nick> – Ping user
* /version [nick] – Get version info
Advanced Commands:
* /ctcp <nick> <command> – Send CTCP command
* /motd [server] – View message of the day
* /stats <query> [server] – View server statistics
* /raw <command> – Send raw IRC command (if enabled)
Type /help in the chat for the complete command reference.
Configuration: Go to Settings → Chat for WebIRC in your WordPress admin to customize servers, channels, and security options.
Notes
- Some public IRC networks may restrict WebSocket connections to certain origins. The included test server permits connections for testing purposes.
- Do not send sensitive information. This client is intentionally minimal and does not yet support SASL authentication.