
A WebSocket server that your PHP application talks to over a socket, now with Laravel Echo support, and an honest list of what was checked and what was not.
What wsrv is
PHP's usual process-per-request model is a poor fit for holding thousands of open sockets. wsrv puts the sockets somewhere else. wsrvd is a daemon written in C++23, a from-scratch implementation of RFC 6455 with no third-party WebSocket library, under the Apache-2.0 license. It owns the browser connections. Your PHP code connects to it over a Unix socket (or, since 1.1, over TCP with a generated token) and only reacts to events: a browser asked to connect, a message arrived, a connection closed.
docker run -d --name wsrvd -p 8080:8080 \
-v wsrv-ipc:/run/wsrv \
-e WSRVD_ALLOW_ORIGIN=https://app.example.com \
-e WSRVD_BROKER=true \
dimathjayasinghe/wsrvd:1.1.0
$worker = new Wsrv\Worker(Wsrv\Client::connect('/run/wsrv/ipc.sock'));
$worker->on('message', fn ($conn, $data) => $conn->send($data));
$worker->run();
What 1.1 adds: Laravel Echo
Version 1.1.0, released on 28 November 2026, lets a Laravel application use broadcast() and Laravel Echo with wsrv as the WebSocket server.
composer require wsrv/client
Run the daemon with a publish token that its own generator made (since 1.1 the daemon accepts no other), and with limits sized for a channel per user. These commands are the ones in the guide; the numbers on the last two lines suit a site with up to about 10,000 browsers online, and the guide explains each one:
wsrvd --generate-token=/run/wsrv/publish.token
wsrvd --ipc-socket=/run/wsrv/ipc.sock --listen-port=8080 \
--allow-origin=https://app.example.com \
--broker=true --publish-port=9200 --publish-token-file=/run/wsrv/publish.token \
--max-message-size=262144 --ipc-max-frame=524286 \
--broker-max-topics=50000 --broker-max-subscriptions=500000
Then the Laravel side:
BROADCAST_CONNECTION=wsrv
WSRV_APP_KEY=any-public-name
WSRV_APP_SECRET=at-least-16-random-bytes-never-in-the-browser
WSRV_PUBLISH_TOKEN_FILE=/run/wsrv/publish.token
php artisan wsrv:echo
wsrv:echo is a small worker that speaks the Pusher WebSocket protocol to the browser and checks the signatures your /broadcasting/auth route hands out. In the browser you use Echo's usual options (key, wsHost, wsPort, forceTLS) and the usual calls: Echo.channel(...), Echo.private(...), Echo.join(...), whispers included. Public, private, presence and encrypted channels are implemented and tested.
The full guide, including the Docker, systemd and Sail setups and the limits, is docs/LARAVEL_ECHO.md.
What was actually run
On 28 November 2026 the real pusher-js 8.6.0 and laravel-echo 2.6.3 ran in Chrome 156 against wsrv twice: once with a small stand-in for the Laravel routes and once with a real Laravel 13.43 application. Both runs passed 12 of 12 checks.
Two things that run did not cover. Laravel 13.43 is the only Laravel version it ran against, and Echo was configured with its reverb broadcaster option; the pusher broadcaster reaches the same pusher-js code but was not run.
Claims you can check
A claim you cannot check is an adjective, so the repository has a page, docs/EVIDENCE.md, that lists each claim, the command that checks it, the last result and what that result does not show. A few rows:
- Protocol. Autobahn|Testsuite: 517 cases, 0 failed, plain and over
wss://, run on the 1.0.0 sources on 26 November 2026. Not re-run for 1.1. - Tests. 1,634 tests pass with AddressSanitizer and UBSan, and the same suite runs under ThreadSanitizer in CI. 14 fuzz targets run for five seconds each on every change, which is a smoke test, not continuous fuzzing.
- Staying up. A two-hour run on the release image with 200 reconnecting clients and 162 injected faults (daemon restarts,
kill -9, network cuts): every client was back after every fault and the daemon never crashed. Run by hand on 25 November 2026, on the 1.0 line. - Releases. Images are scanned before they are pushed, signed with cosign and carry build provenance; each release has an SBOM and checksums. For
v1.1.0they were checked from the published artifacts after release (checksums, attestations, the cosign signature on GHCR and on Docker Hub, and that both registries carry the same image); the record is in section 7 of docs/RELEASE.md.
There has been no external security audit of the code, the protocol implementation or the TLS configuration. The reviews done during development are recorded in the repository with their findings.
What went wrong on the way
A project that lists its evidence should also list its mistakes. Here is some of what the checking found.
A benchmark found bugs no unit test had reached. Running thousands of connections showed that the server accepted at most 4,095 at once (its event queue held 4,096 slots), that a broadcast to a 5,000-subscriber room reached only 61 percent of it, and that closing 5,000 connections left 904 open for good. All three are fixed; the write-ups are in BENCHMARKS.md and the lessons in docs/learning/.
A security review of the Echo branch found a way to lock everyone else out. On the default configuration, 16 scripted connections from one address joined 1,023 anonymous public channel names in 0.07 seconds, and a signed-in user who arrived afterwards was refused private-user.7 and presence-room.1 with LimitReached: The server is at its channel limit. It needed no signature and broke none of the per-connection limits. Public channel names now have their own budget (maxPublicChannels, default 512) and a site can list its public channels exactly. The change landed before the release.
A message that could never be sent used to vanish. A message larger than the outbound queue could take was accepted and then silently dropped. It is now refused where the sender can see it.
One breaking change, on purpose. In 1.1 the publish token must be one that wsrvd --generate-token made. A hand-made token (for example from openssl rand) now stops the start with a message that says how to fix it. Upgrading from 1.0 starts at docs/UPGRADING.md.
Speed, with both sides
docs/BENCHMARKS.md compares wsrv with the PHP WebSocket servers people commonly run, with every number, the noise between runs and the harness, so that you can rerun it. On one laptop under Docker Desktop:
- With four CPUs, wsrv does 1.5 to 1.8 times the echo messages per second of the single-process servers at 64 connections, and a broadcast reaches the last of 5,000 subscribers in about half the time.
- Pinned to one CPU, wsrv is behind on echo by about 10 to 25 percent, because the daemon and the PHP worker are two processes and every message crosses a Unix socket twice.
The benchmark did not measure TLS, permessage-deflate, authentication, a database behind your handlers or a WAN, and the load generator was written by this project. It is a comparison, not a capacity plan.
Limits to know before you rely on it
- One daemon and one worker per application. There is no backplane between daemons.
- Delivery is at most once. There is no replay of what was published while a client was disconnected.
- Linux only, with
amd64andarm64images. - 1.1 is a new minor release of a project that is a few weeks old (first commit 24 October 2026). Pin an exact version.
Try it, and tell me what breaks
- Code and issues: https://github.com/DimathJayasinghe/wsrv
- Image:
dimathjayasinghe/wsrvdon Docker Hub (alsoghcr.io/dimathjayasinghe/wsrvd), which you can verify withcosign verify, as the Docker Hub page describes. - PHP package:
wsrv/clienton Packagist. - Laravel Echo guide: docs/LARAVEL_ECHO.md
The most useful reports are the ones that break a claim on this page: an Echo feature that does not behave like the Pusher protocol says, a Laravel version other than 13.43, a number that does not reproduce on your hardware. Open an issue, or reply here.
About the author
- Final year Computer Science undergraduate at the University of Colombo School of Computing , focused on backend and real-time systems.
Comments
Join the discussionNo comments yet. Be the first to comment.
wsrv
Notes on wsrv, a WebSocket server written in C++ for PHP and Laravel: releases, what was checked, and what went wrong on the way.

