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(9mo ago)34182.9k↑203.3%9[1 issues](https://github.com/RxPHP/RxWebsocket/issues)[2 PRs](https://github.com/RxPHP/RxWebsocket/pulls)2MITPHPCI failing

Since Jan 27Pushed 9mo ago4 watchersCompare

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

51

—

FairBetter than 95% of packages

Maintenance55

Moderate activity, may be stable

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

295d 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

[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

43.6k344.8k1](/packages/ccxt-ccxt)[cboden/ratchet

PHP WebSocket library

6.4k22.6M259](/packages/cboden-ratchet)[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.6k17.8M115](/packages/laravel-reverb)[ratchet/rfc6455

RFC6455 WebSocket protocol handler

23644.4M83](/packages/ratchet-rfc6455)[voryx/pgasync

Async Reactive Postgres Driver for PHP (Non-blocking)

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

PHP WebSocket library

18103.5k2](/packages/plesk-ratchetphp)

PHPackages © 2026

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