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

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

pogo/websocket
==============

Pogo WebSocket Driver

0.0.4(4mo ago)07[10 PRs](https://github.com/y-l-g/websocket/pulls)GoCI failing

Since Dec 8Pushed 1mo agoCompare

[ Source](https://github.com/y-l-g/websocket)[ Packagist](https://packagist.org/packages/pogo/websocket)[ RSS](/packages/pogo-websocket/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (18)Used By (0)

Pogo WebSocket
==============

[](#pogo-websocket)

Warning
-------

[](#warning)

This project is highly experimental, use with caution.

**The Native, High-Performance Real-Time Solution for PHP.**

- A Caddy module that embeds a scalable, Pusher-compatible WebSocket server directly into the FrankenPHP binary
- CGO-exported functions `pogo_websocket_publish` and `pogo_websocket_broadcast_multi` allow PHP to broadcast messages instantly via shared memory.
- The Caddy module uses FrankenPHP's `ExtensionWorker` API to invoke a dedicated pool of PHP threads for authentication, avoiding network overhead.

---

🚀 Features
----------

[](#-features)

- **Pusher Protocol v7 Compliant:** Supports Private &amp; Presence channels, and User Authentication.
- **High Performance:** Benchmarked at **550+ messages/sec** with sub-10ms latency on minimal hardware.
- **Zero-Copy Broadcasts:** Optimizes CPU usage by encoding messages once for thousands of clients.
- **DoS Protection:** Built-in Token Bucket Rate Limiting, Handshake Throttling, and Circuit Breakers for PHP Auth.
- **Horizontal Scaling:** Redis Pub/Sub support for multi-node clusters.

---

📦 Installation
--------------

[](#-installation)

### Step 1: Build the Binary

[](#step-1-build-the-binary)

#### Pre-built Binary or Docker (Recommended)

[](#pre-built-binary-or-docker-recommended)

You can use the pre-compiled binaries or Docker images that already include the queue module.

- **Binaries:** Download from [FrankenPHP with websocket, queue, and scheduler releases](https://github.com/y-l-g/websocket/releases).
- **Docker:** Use the [docker image](https://github.com/y-l-g?tab=packages&repo_name=websocket).

#### Compile from Source

[](#compile-from-source)

If you prefer to build it yourself, follow [the instructions to install a ZTS version of libphp and `xcaddy`](https://frankenphp.dev/docs/compile/#install-php). Then, use `xcaddy` to build FrankenPHP with the `pogo-queue` module:

```
CGO_ENABLED=1 \
CGO_CFLAGS=$(php-config --includes) \
CGO_LDFLAGS="$(php-config --ldflags) $(php-config --libs)" \
xcaddy build \
    --output frankenphp \
    --with github.com/y-l-g/queue/module \
    --with github.com/dunglas/frankenphp/caddy \
    --with github.com/dunglas/caddy-cbrotli
```

### Step 2: Install the Laravel Broadcast Driver

[](#step-2-install-the-laravel-broadcast-driver)

```
composer require pogo/websocket
php artisan pogo:ws-install
```

⚙️ Configuration
----------------

[](#️-configuration)

Configure the module within your `Caddyfile` at the root of your laravel project (this exemple is an adapted copy of the octane Caddyfile, it will work with `php artisan octane:frankenphp --caddyfile=Caddyfile`).

```
{
    frankenphp {
        worker {
            file "public/frankenphp-worker.php"
        }
    }
    order pogo_websocket before php_server
}

:8080 {
    log {
        level info
    }

    format filter {
        wrap json
        fields {
            uri query {
                replace authorization REDACTED
            }
        }
    }

    route /app/* {
        pogo_websocket {
            app_id          pogo-app
            auth_path       /pogo/auth
            auth_script     public/websocket-worker.php
            webhook_secret  super-secret-key

            handshake_rate  100         # New connection attempts per second (Default: 100)
            handshake_burst 50          # Burst allowance (Default: 50)
            max_connections 10000       # Max concurrent clients
            max_auth_body   16384       # Max PHP Auth response size (bytes)
            max_concurrent_auth 100     # Max concurrent PHP Auth requests (DoS Protection)

            num_workers     2           # Number of PHP workers dedicated to Auth
            num_shards      8           # Internal sharding (Default: 2 * CPU Cores)

            ping_period     54s         # Server Ping interval
            pong_wait       60s         # Client Pong timeout
            write_wait      10s         # Socket write timeout

            # redis_host      localhost:6379
        }
    }

    route {
        root * public
        encode zstd br gzip

        php_server {
            index frankenphp-worker.php
            try_files {path} frankenphp-worker.php
            resolve_root_symlink
        }
    }
}
```

Fill your .env

```
BROADCAST_CONNECTION=pogo
WS_APP_ID=pogo-app
WS_APP_SECRET=super-secret-key #needed for pusher client but not really sensitive i guess

VITE_POGO_HOST=localhost #your site adress
VITE_POGO_PORT=80 #your site port
VITE_POGO_WSS_PORT=443 #your site port
```

Start octane (`frankenphp` must be compiled with `pogo`, use the `dockerfile` or the binary provided in this repo and put it in you bin folder).

```
php artisan octane:start --caddyfile=Caddyfile
# or
frankenphp run --caddyfile=Caddyfile
# or
frankenphp run --config Caddyfile
```

---

📊 Metrics
---------

[](#-metrics)

Prometheus metrics are available at `http://localhost:2019/metrics` (Caddy Admin):

MetricTypeDescription`pogo_websocket_connections_active`GaugeActive TCP connections.`pogo_websocket_messages_total`CounterTotal messages broadcasted.`pogo_websocket_auth_failures_total`CounterFailed auths (labels: `concurrency_limit`, `worker_error`).`pogo_websocket_circuit_breaker_open_total`CounterRequests rejected by Circuit Breaker.`pogo_websocket_broker_dropped_total`CounterMessages dropped due to internal backpressure.`pogo_websocket_subscriptions_total`CounterTotal active subscriptions.`pogo_websocket_auth_duration_seconds`HistogramLatency of the PHP Auth Worker.`pogo_websocket_messages_dropped_total`CounterMessages dropped due to full client buffer.---

🛠 Troubleshooting
-----------------

[](#-troubleshooting)

- **4100 Over Capacity:** Increase `max_connections` in Caddyfile.
- **4009 Connection Unauthorized:** Check `webhook_secret` matches `WS_APP_SECRET`.
- **Too Many Requests:** Tune `handshake_rate` if legitimate traffic is being blocked.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance86

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 77.4% 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 ~9 days

Total

4

Last Release

123d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ab0473dfbbc8924cd343d5fd817e4f8372059e977514e4493555f0694479619?d=identicon)[y-l](/maintainers/y-l)

---

Top Contributors

[![y-l-g](https://avatars.githubusercontent.com/u/116063953?v=4)](https://github.com/y-l-g "y-l-g (48 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (14 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[pusher/pusher-http-laravel

\[DEPRECATED\] A Pusher bridge for Laravel

400509.0k3](/packages/pusher-pusher-http-laravel)[spiral/roadrunner-laravel

Laravel integration for RoadRunner with support for HTTP, Jobs, gRPC, and Temporal plugins - going beyond Octane's capabilities

491320.3k3](/packages/spiral-roadrunner-laravel)[roadrunner-php/laravel-bridge

Laravel integration for RoadRunner with support for HTTP, Jobs, gRPC, and Temporal plugins - going beyond Octane's capabilities

49143.2k1](/packages/roadrunner-php-laravel-bridge)

PHPackages © 2026

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