| 开发者 |
wpsignal
jaredrethman |
|---|---|
| 更新时间 | 2026年11月9日 02:23 |
| PHP版本: | 8.2 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
window.WPS) for themes and plugins to share the connectionwpsignal_token_channels and wpsignal_token_channel_prefixes filters let other plugins add channels and namespace permissions to the JWT without modifying corewpsignal:* DOM events. The relay never sees the payload's plaintext.wordsocket folder to /wp-content/plugins/, or install directly from the WordPress plugin directory.WPSignal is a realtime event delivery service for WordPress. It pushes events from your site to connected browsers the moment they happen, without polling.
Yes. The plugin requires a WPSignal account to relay events. Create a free account at wpsignal.io.
During registration: your site URL and name. During normal operation: event payloads, AES-256-GCM encrypted on every site including plain HTTP ones, with a key derived from your site's WordPress salts that the server never receives, so it never sees their contents. Channel names stay readable because the server routes on them. When real-time collaboration is enabled, Yjs document updates (binary diffs of block editor content) are also relayed. These are not encrypted, so the server could read them; it forwards them by channel and never parses or stores them. All data is delivered in realtime and is not stored on the server. See our Privacy Policy for full details.
Event payloads are encrypted with AES-256-GCM before leaving WordPress. The encryption key is derived from your WordPress salts and site key using HKDF-SHA256, and is never sent to the WPSignal server. This means the relay cannot read your message content. Note: all logged-in users on the same site share the same derived key. Per-user message privacy is out of scope for the current version.
Real-time collaboration was removed from WordPress core before the 7.0 release and currently ships with the Gutenberg plugin as an experiment. Install and activate Gutenberg, then turn on Gutenberg > Experiments > "Enable real-time collaboration". The WordSocket Settings tab shows a "Gutenberg detected" badge when the feature is available, and the sync provider activates automatically once collaboration is enabled. Post types without custom-fields support are excluded by Gutenberg itself.
The built-in client script and the token endpoint (/wp-json/wpsignal/v1/token) are limited to logged-in users by default. To open them to all visitors, return true from the wpsignal_allow_client filter:
add_filter( 'wpsignal_allow_client', '__return_true' );
Tokens minted for visitors carry user ID 0 and are scoped to your site, so keep in mind that anyone can then subscribe to your site's public channels and publish over the WebSocket.
The plugin tells the WPSignal server to archive the site, then deletes the stored credentials (site key, secrets, and the API key if you connected manually). Your usage history stays on the server, and connecting the same site URL again restores the site with fresh secrets. On a manual connection you will need to paste the API key again. If the server cannot be reached, nothing is deleted and you can retry.
The WPSignal dashboard refuses to authorize a site when your plan's site limit is reached (the message names the site to disconnect first), when your account email is not yet verified, or when the account has been deactivated. The Connect tab shows the exact reason returned by the server.
An extension is a separate plugin built on WordSocket (WooCommerce, Live Blog, and Chat are on the way). Its settings appear on the WordSocket settings page under the Extensions tab, which also lists what is available. Developers: register on wpsignal_loaded with WPS::instance()->extensions()->register(), enqueue a settings script on the wordsocket_settings_enqueue action with wpsignal-settings as a dependency, and render window.wordsocket.ExtensionPanel from a plugin registered with wp.plugins.registerPlugin( slug, { scope: 'wordsocket', render } ). An extension with settings of its own adds a tab to this page with window.wordsocket.registerTab( { name, title, render } ) (0.28).
Yes. Reserve a namespace on wpsignal_loaded: WPS::instance()->channels()->reserve( 'orders', 'manage_woocommerce' ) (a capability, or a callable receiving the user ID). The relay then refuses subscribe and publish frames on that namespace from anyone else. Once any namespace is reserved, tokens list channels explicitly instead of allowing every channel of the site, so register each channel you subscribe to through the wpsignal_token_channels filter. Payload encryption is site-wide and is not a privacy boundary between users; the channel gate is.
Each plan has a monthly message quota. When it is reached the server answers publishes with "quota exceeded" and the plugin pauses publishing until the first day of the next month (UTC). The Connect tab on the WordSocket settings page shows this, as well as rejected credentials (disconnect and connect again) and an unreachable server, and clears the warning as soon as the server answers again. There is no admin notice.
The client falls back to SSE for receiving events. window.WPS.subscribe() and window.WPS.unsubscribe() work on SSE connections: channel changes are tracked and applied immediately via a lightweight SSE reconnect (50 ms debounce). Collaborative editing needs WebSocket, because SSE is receive-only: if the editor opens while the client is on SSE, collaboration stays off for that editor until the page is reloaded with WebSocket available. You can also disable the collaboration provider from the WordSocket Settings tab to use Gutenberg's HTTP polling for all editors instead.
Nothing until you switch it on (Settings tab, the Journeys card), which also adds the Journeys tab. On, each visit is kept as a journey: the pages opened as ids with the time on each, when the tab was hidden, how the visit ended, and the moments that fired, under a random browser id, linked to the account for the visits the visitor was logged in. Never a URL, a title or a search term. It stays in your own database for the months you set (3 by default) and the privacy tools under Tools can export and erase a person's journeys.
Moments are off until you switch them on (Settings tab, the Moments card). A moment watches each visitor in their own browser and steps in when its conditions come true: show text or a synced pattern as a modal, banner, bar, toast or panel, and, with "Flash the tab title" switched on, follow the visitor to a hidden tab (the title flashes and the favicon is badged until they return; the prompt is already there when they do). A synced pattern a switched-on moment shows is served to any visitor who asks for it. Conditions cover the page (its kind, a page id, a term id, a taxonomy archive), time on it while visible or while hidden, pages so far, what was seen earlier, the time of day on the site's clock or the visitor's, the day of the week, new or returning, logged in, and the device. Extensions add their own, and ShopSocket adds the cart.
WPS.config is a read-only { version, isDebug, siteName, page: { kind, id } } built for plugins, and WPS.debug() logs only while debug mode is on, so a plugin never reads WordSocket's own inline configWPS.recovery shows a prompt as a modal, banner, bar, toast or slide-in panel, flashes the tab title, badges the favicon or plays a chime, and WPS.attention says whether the visitor is on the page, in another window or on a hidden tab. Nothing shows until a moment or an extension askswpsignal_visitor_visit_response adds, read in the browser through tracker.onVisit(), so a plugin gets its own state in the request every page already makes instead of a second one. The report option may be a function, so a plugin reports only the visitors it would store.WPS::journeys() to put a reference and a value on a journey, end it with an outcome of their own (an order), credit the moments that led there, and have it drawn and named on the Journeys tab.wpsignal_token_lifetime filter, at the cost of a longer window before a logged-out user's grants lapse. A visit is reported when something changed, not on every page: the first page, the tab going hidden, a page an extension names, and otherwise once a minute, so moving between pages costs your server nothing.&tab=shopsocket) opens that tab every time; it used to land on Connect more often than not.WPS.presence.track( channel ) follows a visitor's journey across the site over relay presence (the pages they open, with times, and when the tab is hidden) and reports each visit and leave to WordPress, where the wpsignal_visitor_visit and wpsignal_visitor_leave actions let a plugin store it. WordSocket stores nothing itselfwpsignal_page_step filter names the step a page is in a journeywindow.wordsocket.useTask runs a request and reports it in the same toastswindow.wordsocket.registerTab()); ShopSocket's settings live therewp.sync global. The provider now takes the editor's Yjs instance from the Y option Gutenberg passes it, and still reads the global on older versionsws:// from the page's scheme instead of the relay's, so the TLS handshake failed (close 1006)wordsocket_nested_plugin_rows filters the rows and an empty array switches it offWPS.uuid() returns a v4 UUID and works on plain HTTP sites too, where browsers do not offer crypto.randomUUIDWPS.visitorId() is a stable per-browser id shared by every tab and extension on the site, for counting people rather than connectionsWPS.onChannel( channel, expected ) tells a handler whether an event arrived on the channel it claims, so events published elsewhere can be ignoredGET /wpsignal/v1/stats reports how many browsers are connected to the site right now and the plan's connection limit (WPS::instance()->publisher()->stats() in PHP), for extension dashboardsreserve( $ns, $read, $write )) or the wpsignal_token_publish_prefixes filter says otherwiseWPS.setPresence() for connection-scoped presence (who is here right now); subscribers receive wps.presence join/leave/sync events, WPS.setPresence( channel, null ) leaves at once, and a member drops the instant its connection closeswindow.wordsocket, wordsocket_settings_enqueue, WPS::instance()->extensions())WPS::instance()->channels()->reserve( $namespace, $capability ) gates a channel at the token level; once any namespace is reserved, tokens list channels explicitly.pot language file added (eventra-for-wpsignal.pot).objectId; the provider now maps this to a shared "collection" channel suffix so all peers join the same channel.ProviderCreatorOptions type updated to accept objectId: string | number | null, matching the Beta 2 provider creator API.wpsignal_token_channels filter: plugins can append channels to the initial auto-subscribe list in the minted JWT.wpsignal_token_channel_prefixes filter: plugins can add channel-prefix permissions to the JWT allowed_channel_prefixes claim, enabling server-enforced access to custom channel namespaces.window.WPS.subscribe() and window.WPS.unsubscribe() now work on SSE connections. Channel changes are tracked in a persistent set and applied immediately via a debounced SSE reconnect, so plugins that call these methods do not need to know the current transport.forceSSE config flag available for testing the SSE transport without browser tooling.wpsignal_encryption_seed filter for plugins and themes to supply custom key material.SubtleCrypto decryption in the browser client: events are dispatched only after successful decryption.publishBinary() and onBinaryMessage() methods on window.WPS for binary WebSocket frames.transport property on window.WPS exposes the current connection type ('ws', 'sse', or null).disconnected status when WebSocket is unavailable, allowing WordPress to show its "not synced" indicator.window.WPS): subscribe, publish, event listeners.WPS::trigger() fluent builder and WPS::publish() facade methods.WPSignal namespace.@wordpress/scripts build pipeline.