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(6mo ago)34181.5k↓50%9[2 PRs](https://github.com/RxPHP/RxWebsocket/pulls)2MITPHPCI passing

Since Jan 27Pushed 6mo ago4 watchersCompare

[ Source](https://github.com/RxPHP/RxWebsocket)[ Packagist](https://packagist.org/packages/rx/websocket)[ RSS](/packages/rx-websocket/feed)WikiDiscussions master Synced 1mo 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

54

—

FairBetter than 97% of packages

Maintenance66

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

203d ago

Major Versions

0.10.0 → 1.0.02017-03-21

1.0.2 → 2.0.02017-09-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d3dd76986135ec7771465f6e0e187478b3d4b50ed4bde14da7e27db84c35f14?d=identicon)[mbonneau](/maintainers/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.4k21.4M239](/packages/cboden-ratchet)[ratchet/rfc6455

RFC6455 WebSocket protocol handler

23433.7M69](/packages/ratchet-rfc6455)[plesk/ratchetphp

PHP WebSocket library

1865.9k2](/packages/plesk-ratchetphp)

PHPackages © 2026

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