PHPackages                             wanick/web-socket-queue - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. wanick/web-socket-queue

ActiveLibrary[Queues &amp; Workers](/categories/queues)

wanick/web-socket-queue
=======================

PHP project for web sockets and Queue WebSockets

v1.0.7(9mo ago)111.1k↓25.9%MITPHPPHP &gt;=7.4.0

Since Sep 19Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/wanick/web-socket-queue)[ Packagist](https://packagist.org/packages/wanick/web-socket-queue)[ Docs](https://github.com/wanick/web-socket-queue)[ RSS](/packages/wanick-web-socket-queue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (5)Used By (0)

PHP WebSocket Asynchronous Queue library
========================================

[](#php-websocket-asynchronous-queue-library)

###  Usage with [ ![SurrealDB](https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/white/text.svg) ](https://surrealdb.com#gh-dark-mode-only)

[](#----usage-with-------------)

Examples
========

[](#examples)

```
use Wanick\WebSocketQueue\Drivers\SurrealDriver;

// link to RCP SurrealDB
$surreal = new SurrealDriver('wss://hostname:8080/rcp');

if ($surreal) {
  $surreal->use($config['ns'], $config['db'])
    ->signin([
      "user" => $config['user'],
      "pass" => $config['pass'],
    ], function($resulr, $error) {
        // .... your code
    })
    ->query('SELECT * FROM people WHERE ago > $ago', ['ago' => 18], function($result, $error) {
        // .... your code
        print_r($result[0]);
    })->exec();
}
```

###  Usage with [ ![Nats.io](https://camo.githubusercontent.com/73af515cddda0665f2726904389158dc2c74fc32751b5fffdaa206959f69214d/68747470733a2f2f7777772e676974626f6f6b2e636f6d2f63646e2d6367692f696d6167652f77696474683d31322c6470723d322c6865696768743d31322c6669743d636f6e7461696e2c666f726d61743d6175746f2f68747470732533412532462532463638333839393338382d66696c65732e676974626f6f6b2e696f2532467e25324666696c6573253246763025324662253246676974626f6f6b2d6c65676163792d66696c65732532466f25324673706163657325323532462d4c714d59635a4d4c31627358724e33457a673025323532466176617461722e706e6725334667656e65726174696f6e25334431353731383438303138393032363237253236616c742533446d65646961) NATS ](https://nats.io)

[](#----usage-with----------nats----)

```
use Wanick\WebSocketQueue\Drivers\NatsDriver;
// link to NATS Connection
$nats = new NatsDriver('wss://nats.server.com:8080/nats');
if ($nats) {
  $nats
    ->pub("EVENT_NAME", ['event' => 'test', 'data' => 123])
    ->pub("EVENT_NAME", ['event' => 'test', 'data' => 234])
    ->exec();
}
```

Example listening
=================

[](#example-listening)

```
use Wanick\WebSocketQueue;

$queue = new WebSocketQueue\Queue();
$surreal = new SurrealDriver($url);
// this $surreal use + signin

$nats = new NatsDriver($url);

$nats->sub('ON-YOUR-CUSTOM-EVENT', null, function(string $result) use($surreal) {
    $data = json_decode($result, true); // if you write in JSON format to NATS
    switch ($data['action']) {
        case 'alert':
            $surreal->query('UPDATE table_name SET field = $value WHERE id = $id', [
                'id' => $data['id'],
                'value' => 1,
            ]);
            // Add "->exec()", if you want saving right now
            // $queue->wait  execute this query on loop
        break;
    }
});

// can use
// $surreal->live('table_name' ... for all table event

$surreal->liveQuery('SELECT * FROM table_name WHERE field > $max', [ 'max' => 10],
    function ($action, $result) use($nats) {
        switch ($action) {
            case 'UPDATE':
                $nats->pub("ON-YOUR-CUSTOM-EVENT", ['action' => 'alert', 'id' => $result['id']]);
                // can be ->exec()
                break;
            default:
                // no action  CLOSE, CREATE, CONNECT, DELETE
                // use CONNECT - for saving queryUuid  for use liveListener or kill
                break;
        }
    });

$queue->registrySocket($surreal);
$queue->registrySocket($nats);

// Locked loop - and example max work time execute
$queue->wait(fn($s) => (microtime(1) - $s < $max_work_time));
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance58

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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.

###  Release Activity

Cadence

Every ~111 days

Total

4

Last Release

270d ago

### Community

Maintainers

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

---

Top Contributors

[![wanick](https://avatars.githubusercontent.com/u/966341?v=4)](https://github.com/wanick "wanick (22 commits)")

---

Tags

wsweb socketsurrealdbnats

### Embed Badge

![Health badge](/badges/wanick-web-socket-queue/health.svg)

```
[![Health](https://phpackages.com/badges/wanick-web-socket-queue/health.svg)](https://phpackages.com/packages/wanick-web-socket-queue)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[basis-company/nats

nats jetstream client for php

201354.3k19](/packages/basis-company-nats)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2228.8M171](/packages/react-async)[react/promise-stream

The missing link between Promise-land and Stream-land for ReactPHP

11512.9M45](/packages/react-promise-stream)

PHPackages © 2026

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