npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cocreate/socket-server

v1.36.0

Published

High-density multi-tenant WebSocket orchestration server for real-time state synchronization and cluster-mesh collaboration.

Readme

CoCreate Socket Server

A high-performance, multi-tenant WebSocket orchestration layer engineered for real-time collaboration, instant data synchronization, and ultra-low latency event streaming. This module serves as the primary gateway for end-user web applications interacting with the CoCreate clustered network.


Documentation

For complete API references, protocol event schemas, configuration guides, and examples, visit the CoCreate Socket Server Documentation.

Table of Contents


The Real-Time Multiplexing Core

@cocreate/socket-server manages hundreds of thousands of concurrent persistent client connections with a zero-allocation, stream-oriented architecture.

Native Binary Transport

To minimize serialization overhead and avoid high CPU usage, all real-time payloads can be encoded natively as binary streams using protocol buffers or compact JSON-in-MsgPack formats. This reduces network payload size by up to 60% compared to raw stringified JSON payloads.

Organization & Room Isolation

Sockets are automatically classified upon connection based on authenticated organization context. Client connections can only subscribe to channels matching their tenant scopes, keeping data partitions strict and secure at the gateway edge.

$$ \text{Client Connection Request} \xrightarrow{\text{JWT Authentication}} \text{Isolated Tenant Context} \implies \begin{cases} \text{Room 1} & \text{(Document Sync)} \ \text{Room 2} & \text{(Presence Engine)} \end{cases} $$

 [Client App] ──► [WebSocket Connection] ──► [Socket Server Edge] ──► [Tenant Context Mapping]
                                                                            │
                                                                            ▼
                                                                     [Enforced Privacy]

Why CoCreate Socket Server?

Standard real-time libraries (such as Socket.IO) introduce protocol wrapping overhead and maintain relatively heavy memory footprints per client, limiting total connection density on typical hardware.

@cocreate/socket-server is built on top of high-performance, low-level engine bindings, ensuring near-native socket operations. It tracks user presence, real-time collaboration, and administrative events with minimal overhead, allowing a single server instance to support tens of thousands of concurrent active connections.


Multi-Tenant Rooms & Subscriptions

The socket server divides message distributions into isolated communication layers.

| Channel Scope | Delivery Mechanism | Common Use Case | | --- | --- | --- | | Organization Room | Broadcast across tenant nodes | System announcements and configuration synchronization. | | Document Room | Focused cluster routing | Real-time collaboration, cursor synchronization, and document updates. | | User Direct Channel | Unicast targeted messaging | Personal notifications and account-specific events. | | Mesh Control Tunnel | Internal inter-server communication | Administrative coordination and node draining. |


The Connection Degradation Vector

To help @cocreate/server-telemetry evaluate worker saturation, the socket server continuously tracks local connection density ($D_c$).

$$ D_c = \frac{\text{Active Sockets}} {\text{Max Node Capacity}} \cdot \ln(\text{Messages Per Second}+1) $$

As connection density approaches configured limits, the socket server notifies the surrounding infrastructure so new client connections can be routed toward healthier nodes.


Graceful Reconnection & State Recovery

Temporary network interruptions should not interrupt collaboration.

When a client disconnects unexpectedly, its session is placed into a short-lived recovery state. Outbound events are temporarily buffered in memory. If the client reconnects with its session identifier before the recovery window expires, pending events are replayed and synchronization continues without requiring the application to rebuild state.


Configuration

Create a socket.config.json file in your server root directory.

{
  "port": 8080,
  "maxConnections": 50000,
  "pingIntervalMs": 25000,
  "pingTimeoutMs": 5000,
  "maxPayloadBytes": 1048576,
  "compression": {
    "enabled": true,
    "thresholdBytes": 1024
  },
  "security": {
    "requireAuth": true,
    "authTimeoutMs": 5000
  }
}

Installation

npm

npm install @cocreate/socket-server

Yarn

yarn add @cocreate/socket-server

How to Contribute

We encourage contributions to all CoCreate libraries. Please see our CONTRIBUTING.md guide for development workflows and contribution guidelines.

If you discover a bug or would like to request a feature, please open an issue on our GitHub Issues tracker.

For complete documentation, examples, and integration guides, visit:

https://cocreatejs.com/docs/socket-server


License

This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.

  • Open Source Use: For open-source projects and non-commercial use, this software is available under the AGPLv3. See the LICENSE file for the complete license text.
  • Commercial Use: Commercial users must obtain a commercial license. Commercial licenses are available when signing up for an API key through the CoCreate platform.