PHPackages                             andreybolonin/ratchet-multi-instance - 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. andreybolonin/ratchet-multi-instance

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

andreybolonin/ratchet-multi-instance
====================================

Ratchet multi instance

87[1 issues](https://github.com/andreybolonin/RatchetMultiInstance/issues)PHP

Since Apr 10Pushed 8y ago2 watchersCompare

[ Source](https://github.com/andreybolonin/RatchetMultiInstance)[ Packagist](https://packagist.org/packages/andreybolonin/ratchet-multi-instance)[ RSS](/packages/andreybolonin-ratchet-multi-instance/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

QuickStart
==========

[](#quickstart)

### 0) Check, do you install high perfomance ext-event extension (libevent)

[](#0-check-do-you-install-high-perfomance-ext-event-extension-libevent)

Connectionsstream\_selectlibevent10010.6569.29850011.1759.79180017.3279.709100023.2829.749

### 1) Define your pool (config/services.yaml)

[](#1-define-your-pool-configservicesyaml)

`wampserver_broadcast: ['127.0.0.1:8095', '127.0.0.1:8097', '127.0.0.1:8099']`

### 2) Exclude this node

[](#2-exclude-this-node)

`$key = array_search($this->websocket_this_node, $this->wampserver_broadcast);`

`unset($this->wampserver_broadcast[$key]);`

### 3) Run your nodes

[](#3-run-your-nodes)

`bin/console server:run --port=8095`

`bin/console server:run --port=8097`

`bin/console server:run --port=8099`

### 4) Setup NGINX (as load balancer)

[](#4-setup-nginx-as-load-balancer)

```
upstream socket {
    server 127.0.0.1:8095;
    server 127.0.0.1:8097;
    server 127.0.0.1:8099;
}

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
	server_name 127.0.0.1;
	listen 8090;

	proxy_next_upstream error;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Scheme $scheme;
	proxy_set_header Host $http_host;

	location / {
		proxy_pass http://socket;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host;

                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
                proxy_read_timeout 86400; # neccessary to avoid websocket timeout disconnect
                proxy_redirect off;
	}
}
```

[http://nginx.org/en/docs/http/load\_balancing.html](http://nginx.org/en/docs/http/load_balancing.html)

### Installation

[](#installation)

1. `composer req andreybolonin/ratchet-multi-instance`
2. Inject `use RatchetMultiInstanceTrait;` into your Topic class
3. Add `broadcast/channel` into you Topic class

```
public function onPublish(ConnectionInterface $connection, $topic, $event, array $exclude, array $eligible)
{
    switch ($topic->getId()) {
     case 'counter/channel':
         $this->CounterTopic($connection, $topic, $event, $exclude, $eligible);
         break;

     case 'price/channel':
         $this->PriceTopic($connection, $topic, $event, $exclude, $eligible);
         break;

     case 'broadcast/channel':
         $this->BroadcastTopic($connection, $topic, $event, $exclude, $eligible);
         break;
    }
}
```

4. Send the `$topic->broadcast($event)` with `$this->broadcast($event)` for broadcasting in another WampServer nodes

### Arch

[](#arch)

[![](https://raw.githubusercontent.com/andreybolonin/RatchetMultiInstance/master/RatchetMultiInstance.png)](https://raw.githubusercontent.com/andreybolonin/RatchetMultiInstance/master/RatchetMultiInstance.png)

### 5) Symfony Bundle

[](#5-symfony-bundle)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/adc3d0e11e285a41f126df479eeb9c7b00107008c507b177ea2921ae1c314eda?d=identicon)[andreybolonin](/maintainers/andreybolonin)

---

Top Contributors

[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (15 commits)")

### Embed Badge

![Health badge](/badges/andreybolonin-ratchet-multi-instance/health.svg)

```
[![Health](https://phpackages.com/badges/andreybolonin-ratchet-multi-instance/health.svg)](https://phpackages.com/packages/andreybolonin-ratchet-multi-instance)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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