PHPackages                             rx/websocket - 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. rx/websocket

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

rx/websocket
============

Websockets for PHP using Rx

2.3.0(8mo ago)35182.6k↑217.9%9[1 issues](https://github.com/RxPHP/RxWebsocket/issues)[2 PRs](https://github.com/RxPHP/RxWebsocket/pulls)2MITPHPCI failing

Since Jan 27Pushed 8mo ago4 watchersCompare

[ Source](https://github.com/RxPHP/RxWebsocket)[ Packagist](https://packagist.org/packages/rx/websocket)[ RSS](/packages/rx-websocket/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (21)Used By (2)

[![CI status](https://github.com/RxPHP/RxWebsocket/workflows/CI/badge.svg)](https://github.com/RxPHP/RxWebsocket/actions)

Rx\\Websocket is a PHP Websocket library.

Usage
-----

[](#usage)

#### Client

[](#client)

```
$client = new \Rx\Websocket\Client('ws://127.0.0.1:9191/');

$client->subscribe(
    function (\Rx\Websocket\MessageSubject $ms) {
        $ms->subscribe(
            function ($message) {
                echo $message . "\n";
            }
        );

        $sayHello = function () use ($ms) {
            $ms->onNext('Hello');
        };

        $sayHello();
        \EventLoop\addPeriodicTimer(5, $sayHello);
    },
    function ($error) {
        // connection errors here
    },
    function () {
        // stopped trying to connect here
    }
);
```

#### An Echo Server

[](#an-echo-server)

```
$server = new \Rx\Websocket\Server('127.0.0.1:9191');

$server->subscribe(function (\Rx\Websocket\MessageSubject $cs) {
    $cs->subscribe($cs);
});
```

#### Server that dumps everything to the console

[](#server-that-dumps-everything-to-the-console)

```
$server = new \Rx\Websocket\Server('127.0.0.1:9191');

$server->subscribe(function (\Rx\Websocket\MessageSubject $cs) {
    $cs->subscribe(function ($message) {
        echo $message;
    });
});
```

Installation
------------

[](#installation)

Using [composer](https://getcomposer.org/):

`composer require rx/websocket`

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance60

Regular maintenance activity

Popularity42

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~197 days

Recently: every ~364 days

Total

19

Last Release

249d ago

Major Versions

0.10.0 → 1.0.02017-03-21

1.0.2 → 2.0.02017-09-12

### 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 (50 commits)")[![davidwdan](https://avatars.githubusercontent.com/u/4969183?v=4)](https://github.com/davidwdan "davidwdan (10 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (4 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (1 commits)")

---

Tags

phprxrxphpwebsocket-clientwebsocket-serverwebsocketswebsocketWebSocketsrfc6455reactreactiverxrx.php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rx-websocket/health.svg)

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

###  Alternatives

[cboden/ratchet

PHP WebSocket library

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

RFC6455 WebSocket protocol handler

23641.1M76](/packages/ratchet-rfc6455)[voryx/pgasync

Async Reactive Postgres Driver for PHP (Non-blocking)

11297.9k4](/packages/voryx-pgasync)[plesk/ratchetphp

PHP WebSocket library

1891.6k2](/packages/plesk-ratchetphp)

PHPackages © 2026

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