PHPackages                             venndev/vosaka-wsock - 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. venndev/vosaka-wsock

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

venndev/vosaka-wsock
====================

A library for web-socket

1.0.0(1mo ago)10MITPHP

Since Mar 12Pushed 1mo agoCompare

[ Source](https://github.com/vosaka-php/vosaka-wsock)[ Packagist](https://packagist.org/packages/venndev/vosaka-wsock)[ RSS](/packages/venndev-vosaka-wsock/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

VOsaka WSock
============

[](#vosaka-wsock)

**Vosaka Wsock** is a high-performance, asynchronous WebSocket library for PHP, designed to be lightweight, extensible, and easy to use. It is built on top of [Vosaka Fourotines](https://github.com/venndev/vosaka-fourotines), leveraging cooperative multitasking for efficient handling of concurrent connections.

Features
--------

[](#features)

- **Asynchronous I/O**: Fully non-blocking server implementation.
- **Room Support**: Built-in support for rooms, allowing easy broadcasting to specific groups of clients.
- **Middleware**: Extensible middleware system (e.g., for rate-limiting, authentication).
- **Handshake Control**: Customizable handshake logic via `onHandshake`.
- **JSON Ready**: Convenient methods for sending and receiving JSON messages.
- **Connection Management**: Robust connection registry and tracking.

Installation
------------

[](#installation)

Install via Composer:

```
composer require venndev/vosaka-wsock
```

Quick Start
-----------

[](#quick-start)

Create a simple chat server by extending `AbstractWebSocketHandler`:

```
use vosaka\wsock\connection\Connection;
use vosaka\wsock\connection\Message;
use vosaka\wsock\server\AbstractWebSocketHandler;
use vosaka\wsock\server\ServerConfig;
use vosaka\wsock\server\WebSocketServer;
use vosaka\wsock\connection\ConnectionRegistry;
use vosaka\foroutines\RunBlocking;
use function vosaka\foroutines\main;

final class ChatHandler extends AbstractWebSocketHandler {
    public function onOpen(Connection $connection): void {
        echo "New connection: {$connection->id}\n";
        $connection->sendText("Welcome to the server!");
    }

    public function onMessage(Connection $connection, Message $message): void {
        if ($message->isText()) {
            echo "Message from {$connection->id}: {$message->getContent()}\n";
            $connection->sendText("Echo: " . $message->getContent());
        }
    }
}

main(function () {
    RunBlocking::new(function () {
        $config = new ServerConfig(host: '0.0.0.0', port: 9000);
        $registry = new ConnectionRegistry();
        $server = new WebSocketServer(
            config: $config,
            handler: new ChatHandler($registry),
            registry: $registry
        );

        $server->start();
        echo "WebSocket server started on ws://localhost:9000\n";
    });
});
```

Core Components
---------------

[](#core-components)

- **`WebSocketServer`**: The main server class that handles TCP connections and WebSocket handshakes.
- **`AbstractWebSocketHandler`**: Interface/base class for defining your application logic (onOpen, onMessage, onClose).
- **`Connection`**: Represents an active WebSocket client connection.
- **`Room`**: A group of connections for easy broadcasting.
- **`ConnectionRegistry`**: Manages all active connections and their room associations.

Extensions &amp; Dependencies
-----------------------------

[](#extensions--dependencies)

- [venndev/vosaka-fourotines](https://github.com/venndev/vosaka-fourotines): The underlying coroutine engine.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance88

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

58d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98d6345d2f426ddfe6194080e1bb82d51ade7ea060273803a40aa446f8455151?d=identicon)[venndev](/maintainers/venndev)

---

Top Contributors

[![VennDev](https://avatars.githubusercontent.com/u/111500380?v=4)](https://github.com/VennDev "VennDev (5 commits)")

### Embed Badge

![Health badge](/badges/venndev-vosaka-wsock/health.svg)

```
[![Health](https://phpackages.com/badges/venndev-vosaka-wsock/health.svg)](https://phpackages.com/packages/venndev-vosaka-wsock)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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