PHPackages                             voryx/websocketmiddleware - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. voryx/websocketmiddleware

ActiveLibrary[HTTP &amp; Networking](/categories/http)

voryx/websocketmiddleware
=========================

WebSocket Middleware for React

2.0.1(1y ago)2669.4k53MITPHP

Since Dec 12Pushed 1y ago2 watchersCompare

[ Source](https://github.com/voryx/WebSocketMiddleware)[ Packagist](https://packagist.org/packages/voryx/websocketmiddleware)[ RSS](/packages/voryx-websocketmiddleware/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (3)Versions (9)Used By (3)

WebSocketMiddleware
===================

[](#websocketmiddleware)

WebSocket Middleware for react/http

Try it out
==========

[](#try-it-out)

Run `chat_ws_server.php` from the examples directory and navigate a few browser windows to  (only tested briefly in Chrome)

Simple Usage
============

[](#simple-usage)

A simple echo server:

```
use Ratchet\RFC6455\Messaging\Message;
use React\EventLoop\Factory;
use React\Http\Server;
use Voryx\WebSocketMiddleware\WebSocketConnection;
use Voryx\WebSocketMiddleware\WebSocketMiddleware;

require __DIR__ . '/../../vendor/autoload.php';

$loop = Factory::create();

$ws = new WebSocketMiddleware([], function (WebSocketConnection $conn) {
    $conn->on('message', function (Message $message) use ($conn) {
        $conn->send($message);
    });
});

$server = new Server($loop, $ws);

$server->listen(new \React\Socket\Server('127.0.0.1:4321', $loop));

$loop->run();
```

Options
=======

[](#options)

By default `WebSocketMiddleware` uses the `ratchet/rfc6455` default max sizes for messages and frames and also disables compression. These settings can be overridden with the `WebSocketOptions` object.

```
$ws = new WebSocketMiddleware(
    [],
    $connectionHandler,
    [],
    WebSocketOptions::getDefault()
        ->withMaxFramePayloadSize(2048)
        ->withMaxMessagePayloadSize(4096)
        ->withPermessageDeflate());
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance42

Moderate activity, may be stable

Popularity37

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 76.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~440 days

Recently: every ~660 days

Total

7

Last Release

482d ago

Major Versions

1.1.0 → 2.0.02020-08-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/748287?v=4)[Matt Bonneau](/maintainers/mbonneau)[@mbonneau](https://github.com/mbonneau)

---

Top Contributors

[![mbonneau](https://avatars.githubusercontent.com/u/748287?v=4)](https://github.com/mbonneau "mbonneau (16 commits)")[![davidwdan](https://avatars.githubusercontent.com/u/4969183?v=4)](https://github.com/davidwdan "davidwdan (3 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (2 commits)")

---

Tags

wsserverwebsocketwebsocket server

### Embed Badge

![Health badge](/badges/voryx-websocketmiddleware/health.svg)

```
[![Health](https://phpackages.com/badges/voryx-websocketmiddleware/health.svg)](https://phpackages.com/packages/voryx-websocketmiddleware)
```

###  Alternatives

[cboden/ratchet

PHP WebSocket library

6.4k22.3M254](/packages/cboden-ratchet)[phrity/websocket

WebSocket client and server

2164.9M41](/packages/phrity-websocket)[plesk/ratchetphp

PHP WebSocket library

1891.5k2](/packages/plesk-ratchetphp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
