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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rsocket-frames-ts

v1.0.6

Published

RSocket frame codec implemented with Uint8Array. Supports full spec, metadata extensions, and browser compatibility.

Readme

A complete RSocket frame codec for browsers and Node.js, implemented with Uint8Array for high-performance serialization and deserialization. Supports all core and extension frames, including MIME types, routing, tracing (Zipkin), and authentication metadata. Ideal for building custom RSocket clients, servers, or intermediaries.

🚀 Features

  • ✔️ Complete RSocket frame specification: Setup, Request, Response, Error, Cancel, Lease, Resume, Payload, etc.
  • ✔️ Fully binary-safe serialization/deserialization via bebyte
  • ✔️ Support for metadata and data MIME types
  • ✔️ Support for Composite Metadata Extension
  • ✔️ Includes RSocket routing, tracing (Zipkin), authentication (Simple/Bearer) extensions
  • ✔️ Factory pattern for dynamic MIME type and auth type resolution
  • ✔️ Works seamlessly in browsers, Node.js, and edge environments

📦 Installation

To install the package using npm:

npm install rsocket-frames-ts bebyte

To install the package using pnpm:

pnpm install rsocket-frames-ts bebyte

To install the package using yarn:

yarn install rsocket-frames-ts bebyte

✅ Recommended Use Cases

  • Browser-based RSocket client implementations
  • Custom RSocket proxies and middlewares
  • Testing tools, fuzzers, and protocol introspection
  • Server-side gateways / bridge adapters

🧰 Usage

Describe your own serializer/deserializer for MimeType

import {MimeType, Metadata, Payload, ByteReader} from "rsocket-frames-ts";

export class ApplicationJson<T = any> extends MimeType<T> {
    private readonly encode = new TextEncoder().encode
    private readonly decode = new TextDecoder().decode

    protected serializePayload(payload: T): Payload<T> {
        return super.serializePayload(this.encode(JSON.stringify(payload)) as T)
    }

    protected deserializePayload(payload: ByteReader): Payload<T> {
        return JSON.parse(this.decode(payload.readRemaining()))
    }


    protected serializeMetadata(payload: T): Metadata<T> {
        // ... write your metadata serializer here
    }

    protected deserializeMetadata(payload: ByteReader, hasPayload: boolean = true): Metadata<T> {
        // ... write your metadata deserializer here
    }
}

export namespace SerializableMimeType {
    export const APPLICATION_JSON = new ApplicationJson('application/json', 0x05)
}

Create and serialize a frame

const frame = new RequestFireAndForgetFrame(
    1, // streamId
    FireAndForgetFlag.combine(FireAndForgetFlag.METADATA, FireAndForgetFlag.FOLLOWS), // Flags
    WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA.toMetadata([ // Metadata
        WellKnownMimeType.MESSAGE_RSOCKET_ROUTING.toMetadata(["fnf"]),
        WellKnownMimeType.MESSAGE_RSOCKET_AUTHENTICATION.toMetadata(
            WellKnownAuthType.SIMPLE.auth({username: "user", password: "pass"})
        )
    ]),
    SerializableMimeType.APPLICATION_JSON.toPayload({ // Payload
        count: 2
    })
)

const serialized = frame.toUint8Array();

Deserialize incoming frame

const deserializedFrame = FrameDeserializer.deserialize(
    serialized, // serialized frame (Uint8Array)
    WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA, // Metadata MimeType
    SerializableMimeType.APPLICATION_JSON // Payload MimeType
)

Contributing

1. Clone the repository:

git clone https://github.com/CKATEPTb/rsocket-frames-ts.git

2. Install dependencies::

pnpm install

3. Run the build::

pnpm run build

License

This project is licensed under the LGPL-3.0-only License.

See the LICENSE.md file for details.

Author

CKATEPTb, fakeivchenko

Feel free to open issues and submit pull requests to improve the library!