Download the PHP package webpatser/resonate-delivery without Composer

On this page you can find all versions of the php package webpatser/resonate-delivery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package resonate-delivery

Resonate Delivery

At-least-once message delivery for Resonate channels. Every broadcast is logged to a per-channel Redis Stream; a reconnecting client sends the id of the last message it saw, and the plugin replays everything since before live delivery resumes.

Solves the single most common WebSocket complaint: "I dropped for 20 seconds and missed messages."

What you get

What this is (and isn't)

Installation

Publish the config to set retention defaults or override the underlying broadcaster:

Configuring the broadcaster

Add the wrapping driver to config/broadcasting.php and point your default at it:

The wrapper delegates auth and the actual WebSocket send to the underlying connection (so your existing Reverb setup is unchanged); it adds the log write and the _replay_id augmentation around it.

Registering the server plugin

In config/reverb.php, list the plugin alongside any others you have running:

Restart Resonate (resonate:reload for a zero-downtime swap).

Client protocol

A client that wants replay sends last_event_id in the subscribe payload:

On every message it receives, the client reads data._replay_id and remembers the highest. On reconnect, it sends that value. First-time subscribers omit the field and get no replay (normal Pusher behaviour).

For Laravel Echo and the JS Pusher client there is no built-in plug for this; consumers must subscribe with the custom data field, which both libraries support via their lower-level subscription APIs.

Ordering

The guarantee is that a reconnecting client sees every replayed message before any live broadcast on that channel, with no interleaving.

That is a stronger claim than it looks, because the replay reads Redis and the connection is a live socket the whole time. The plugin gets it by reading before the connection joins the channel, not after:

  1. The pusher:subscribe interceptor reads the whole missed window into memory. The connection has not joined the channel yet, so a broadcast walking the channel's connection list cannot reach it; the reads can take as many round trips as they need.
  2. Resonate then joins the connection, sends subscription_succeeded, and calls the plugin's onSubscribe, all as straight-line synchronous code. The plugin writes the buffered frames there and performs no I/O, so no other fiber can run in that window and wedge a live message into the middle of the replay.

A message published after the final read is broadcast by a fiber that cannot run until the flush is finished, so it arrives live, after the replay, in order. Nothing is dropped at that seam.

Two consequences worth knowing:

Retention has two axes

MAXLEN ~ N bounds how long a single stream gets. It says nothing about how many streams exist, and a per-entity channel scheme (private-orders.{id}) mints a stream key per entity: broadcast to 100,000 orders and 100,000 keys stay in Redis forever, each holding up to N messages.

So every append also stamps retention.ttl on the key (default 7 days). Because it is refreshed on each append, an actively used channel never expires, while one that goes quiet is reclaimed a window later. Set ttl to 0 to keep every stream forever.

Pick a window longer than the longest disconnect you intend to support. A client returning after the TTL has elapsed finds an empty stream and gets no replay, exactly as if it had fallen out of the MAXLEN window.

Configuration reference

Key Default Purpose
connection REDIS_* env Redis server hosting the streams. The broadcaster (predis) and the plugin (fledge async) must point at the same server/database.
key_prefix delivery Namespace for stream keys ({prefix}:{appId}:{channel}).
retention.default_max_messages 1000 Default per-channel cap.
retention.per_channel [] fnmatch glob => max messages overrides.
retention.ttl 604800 Seconds a stream key survives its last append, refreshed on every append. 0 never expires.
replay_id_field _replay_id The data key that carries each message's stream id.
underlying reverb Name of the broadcaster the wrapper delegates to.
replay_batch_size 100 XRANGE page size during replay.
replay_max_messages 10000 Most messages one replay buffers for a connection; beyond it the replay is truncated and logged. 0 removes the cap.

Requirements

Testing

Tests that touch Redis expect a server on 127.0.0.1:6379 and use database 15; they skip cleanly when no Redis is reachable.

License

MIT. See LICENSE.


All versions of resonate-delivery with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
illuminate/broadcasting Version ^13.0
illuminate/contracts Version ^13.0
illuminate/support Version ^13.0
predis/predis Version ^2.2
webpatser/fledge-fiber Version ^13.29
webpatser/resonate Version ^0.4|^0.5|^0.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webpatser/resonate-delivery contains the following files

Loading the files please wait ...