Real-Time Messaging
Better Messages delivers chat messages in two distinct modes — AJAX polling in the free version (the browser checks for new messages every few seconds) and WebSocket push in the WebSocket version (messages arrive instantly via a persistent connection). The mode determines the perceived speed of the chat — both deliver every message reliably, but the experience is dramatically different.
What it adds#
- Two delivery mechanisms: AJAX polling or WebSocket push
- Configurable polling intervals for AJAX mode (per-conversation and site-wide)
- Instant delivery via persistent WebSocket on the paid version
- Automatic reconnection when the network drops
- Works site-wide — across any page where the plugin is loaded
- Same backend for both modes — switching versions is a setting flip
How each mode works#
AJAX mode (free version)#
The browser polls the WordPress server on a configurable interval (default 3 seconds for the active conversation, 10 seconds for other pages). When new messages exist, they're returned and rendered. This works on any standard WordPress hosting — no extra server, no Node.js, no third-party service.
Trade-offs: a small (1-10 second) delay between sending and receiving, plus continuous low-volume requests to your server.
WebSocket mode (paid version)#
A persistent WebSocket connection runs between the browser and the hosted cloud relay (included with the WebSocket-version license). When someone sends a message, the relay pushes it to all participants' open connections instantly. No polling, no delay.
Trade-offs: requires the WebSocket version license; the cloud relay is the dependency (or self-hosted plan for sites with strict data-sovereignty needs).
| Aspect | AJAX mode | WebSocket mode |
|---|---|---|
| Delivery latency | 1-10 seconds | Instant (<200 ms) |
| Server load | Continuous polling | Minimal — push only on activity |
| Hosting requirements | Any WordPress hosting | Cloud relay included |
| Typing indicator | Not supported | Supported |
| Presence status | Not supported | Supported |
| Web push notifications | Not supported | Supported |
| Voice / video calls | Not supported | Supported |
| End-to-end encryption | Not supported | Supported |
| Site infrastructure | None extra | None extra (relay is hosted) |
When to choose each#
| Site profile | Recommended mode |
|---|---|
| Casual community, hobby site | AJAX free version works fine |
| Marketplace where buyer-seller messaging is core | WebSocket — instant response is competitive |
| Live customer support | WebSocket — chat-app expectations |
| Public chat rooms with many active participants | WebSocket — polling at scale becomes server-heavy |
| Dating / fan community | WebSocket — real-time presence + delivery matters |
| LMS office hours | WebSocket — instant Q&A feels like a real conversation |
How to enable#
Navigate to WP Admin → Better Messages → Settings → General.
- Mechanism — Choose between AJAX or WebSocket
- Thread Interval — Polling rate for the active conversation (AJAX mode, default 3 seconds)
- Site Interval — Polling rate for other pages (AJAX mode, default 10 seconds)
The WebSocket version (paid license) unlocks instant delivery plus typing indicators, presence, web push, voice/video calls, AI chat bots, end-to-end encryption, and group calls. The relay is hosted — no Node.js to deploy, no third-party service to bill against, no extra load on your WordPress server.
Frequently asked questions#
Can I run my own WebSocket server instead of the hosted relay?#
The self-hosted plan lets you run the WebSocket layer on your own infrastructure — useful for strict data-sovereignty requirements (GDPR Article 9, HIPAA-adjacent, jurisdictional rules). Contact support for the build and pricing.
Will increasing polling frequency on free version cost performance?#
Yes — every 1 second of decrease in polling interval roughly doubles request load. Default 3 seconds is a balanced choice. For "near-instant" delivery on the free version, consider upgrading to WebSocket instead of polling at 1 second.
Does the WebSocket version work on shared hosting?#
Yes — the WebSocket connection talks to the cloud relay, NOT to your WordPress server. Your WordPress hosting is unaffected; the connection bypasses it entirely. This is the key architectural advantage.
What happens if the WebSocket connection drops?#
The plugin auto-reconnects when network connectivity returns. Messages sent during the disconnect are queued and delivered on reconnect.
Can I switch between AJAX and WebSocket at runtime?#
Switching is a setting change in the admin — no reinstall. Site-wide for the moment (not per-user). Per-role overrides (e.g. WebSocket for paid members, AJAX for free) are not exposed as a built-in setting today — contact support if your site needs that pattern.
See also#
- Instant delivery — WebSocket-version details
- Typing indicator — WS-only real-time feature
- Presence indicator — WS-only online status
- Load optimization — how WebSocket reduces server load
- Realtime messaging blog post — feature overview