Skip to content

About

Sends realtime events from WordPress to browsers via api.wpsignal.io. Connects via WebSocket (SSE fallback) and exposes a public JS API for other plugins to share the connection. Also provider a WebSocket based provider for WordPress's Realtime Collaboration.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

206 Commits

Folders and files

Repository files navigation

Image

WordSocket

WordPress.org version Downloads Tested up to Requires PHP Build License

The official WordPress plugin for WPSignal. WordSocket enables developers to connect their site to a secure WebSocket relay.

Events are published over one WebSocket per browser, with an SSE fallback, and their contents are AES-256-GCM encrypted before they leave WordPress with a key derived from the site's own salts, so the relay carries ciphertext it cannot read. WordSocket also registers a Yjs sync provider, so Gutenberg's real-time collaboration runs over the same connection instead of HTTP polling.

Install:

WP.org:

The easiest way is to download is wordpress.org/plugins/wordsocket.

WP CLI:

wp plugin install wordsocket --activate

Minimal example:

Create a trigger:

// Fire on any WordPress action hook
WPS::trigger( 'comment.posted' )
    ->on( 'wp_insert_comment', 10, 2 )
    ->channel( 'events' )
    ->data( fn( $id, $comment ) => [ 'author' => $comment->comment_author ] )
    ->register();

Listen and act on trigger when it fires:

type Comment = {
  // ...
};
// Handle it in the browser
const on = WPS.on( 'comment.posted', (comment: Comment) => {
    // Do cool things with the new `comment`
});

Documentation

Full documentation, API reference, and guides are at wpsignal.io/docs.

Extensions

Plugins built on WordSocket, each one installed alongside it and rendering its own panel on WordSocket's Extensions tab. Source for all of them: wpsignal/wordsocket-extensions.

Extension What it does
ShopSocket Shopify's Live View, for WooCommerce: a live orders board for your team, and live stock on product pages. On WordPress.org, or try the live demo store.

Building your own is documented here: register it with WPS::extensions()->register(), reserve a channel namespace, and share the connection WordSocket already holds.

Showcase

Example plugins built on WordSocket, made to read rather than to install: wpsignal/wordsocket-examples.

Changelog

Full changelog can be viewed in CHANGELOG.md

License

GPL-2.0-or-later

About

Sends realtime events from WordPress to browsers via api.wpsignal.io. Connects via WebSocket (SSE fallback) and exposes a public JS API for other plugins to share the connection. Also provider a WebSocket based provider for WordPress's Realtime Collaboration.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages