WebSocket-first
Persistent WebSocket connections with Server-Sent Events as automatic fallback. Keepalive pings every 20 seconds.
WPSignal is a hosted WebSocket relay for WordPress. Publish an event from any action hook with one PHP call and every browser on the site hears it within milliseconds. No server to run, no polling to tune, and event payloads are encrypted before they leave WordPress.
< How it works />
A trigger on any action hook, or one WPS::publish() call, sends an HMAC-signed POST to the relay. The payload is encrypted before it leaves WordPress.
WPSignal delivers the event to every browser subscribed to that site's channels, over WebSocket with SSE as the fallback. Tokens decide who may read and write which channels.
WordSocket's client holds one connection per page and dispatches a native CustomEvent per event. Listen with plain JavaScript or any framework.
< Code />
< Capabilities />
Persistent WebSocket connections with Server-Sent Events as automatic fallback. Keepalive pings every 20 seconds.
Every event is signed with SHA-256 HMAC. Timestamp replay protection and per-site rate limiting built in.
Attach events to any WordPress action hook with a builder: channel, payload, condition and more, in one chain.
WordSocket encrypts event payloads with AES-256-GCM before they leave WordPress, on HTTPS and plain HTTP sites alike, so WPSignal relays ciphertext it cannot read.
Each WordPress site gets its own site key, publish secret and token secret. Channels are namespaced per site and enforced by the relay.
Built-in admin page showing connection status, live event log, publish form, and token inspector for instant debugging.
ShopSocket is built on nothing the public API does not offer. An extension reserves a channel namespace with its own read and write grants, publishes from PHP, holds connection-scoped presence from the browser, and adds a card or a whole tab to WordSocket's settings page. One connection per page, shared by everything on it.
Extension API reference and the extensions repository, where ShopSocket's source is the worked example.
add_action('wpsignal_loaded', function () {
$wps = WPS::instance();
$staff = 'manage_woocommerce';
// Staff read it, only PHP writes to it.
$wps->channels()->reserve('shop:orders', $staff, '__return_false');
// Every shopper announces presence, only staff may listen.
$wps->channels()->reserve('shop:carts', $staff, '__return_true');
// A card on WordSocket's Extensions tab.
$wps->extensions()->register('my-extension', [
'title' => 'My Extension',
'version' => '1.0.0',
'docs_url' => 'https://example.com/docs',
'file' => plugin_basename(__FILE__),
]);
});
WPS::publish('shop:orders:feed', 'order.placed', ['id' => $order_id]);
// Who is here right now; gone the instant the tab closes.
WPS.setPresence('shop:carts:live', { cart: cartId });
// Staff side: joins, leaves, and a sync on subscribe.
WPS.on('wps.presence', (data, channel) => {
if (!WPS.onChannel(channel, 'shop:carts:live')) return;
render(data.action, data.id, data.state, data.members);
});
// Your own tab on WordSocket's settings page (0.28+).
window.wordsocket.registerTab({
name: 'my-extension',
title: 'My Extension',
render: SettingsTab,
});
< Reference />
Connect a site and see an event land in the Explorer in minutes.