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

@passimx/px.connect

v1.2.0

Published

Trustless websocket connection package

Readme

License Status Contributions PRs Welcome GitHub Actions Workflow Status

@passimx/px.connect

High-level WebSocket client with automatic reconnection, cross-tab connection sharing, and built-in RPC/event system.

Overview

PxConnect is a TypeScript library that simplifies building real-time applications over WebSocket.

Instead of manually implementing reconnection logic, heartbeat, tab synchronization, request-response handling, and room management, you work with a simple and consistent API.

License

Passimx Chats Frontend is released under the terms of the MIT license.
See https://opensource.org/license/MIT for more information.

Technologies

| Area | Technologies Used | |------------|---------------------| | API | WebSocket | | Encryption | SHA-512 / Ed25519 |

Installation

npm install @passimx/px.connect
# or
yarn add @passimx/px.connect

Creating instance

import { PxConnect } from '@passimx/px.connect';

const px = new PxConnect('url');

px.connect();

Join channels

px.join('channel:1', 'channel:2', 'channel:3');

Leave channels

px.leave('channel:1', 'channel:2', 'channel:3');

Create new channel

const channel = px.createChannel({ 
  info?: {...}, 
  data?: {...} 
});

Creates a new cryptographically identifiable channel.

  • info — immutable initialization metadata. It becomes part of the channel identity and cannot be changed after creation.
  • data — mutable channel state that can be updated during the channel lifetime.

The channel identifier is deterministically derived from the hash of the initialization data (info). This means that any modification to info results in a different channel ID.

Restore an existing channel

const channel = px.createChannel({ exportInit: {...} });

Restores an existing channel from a previously exported initialization object.

The imported exportInit contains all immutable initialization data required to reproduce the original channel, including its identifier. As long as exportInit remains unchanged, the restored channel will have the same channel ID.

Call action

const result = await px.callAction<T>(
  { connectionId: "..." },   // or { channelId: "..." }
  {
    action: "get-user",
    payload: {...}
  }
);

Invokes a remote action and waits for its response.

The target may be:

  • { connectionId } — send the request directly to a specific connection.
  • { channelId } — send the request to the owner of the channel.

The returned promise resolves with the value passed to reply() on the remote side.

Actions can be addressed either to a specific connection or to a channel.

When a channel is the destination, the request is automatically routed to the channel owner—the connection that originally created the channel.

Connection → Connection

Client A ──── callAction({ connectionId }) ───► Client B Client B ──── reply(...) ───────────► Client A

Connection → Channel

Client A ───────────── callAction({ channelId }) ───► Channel Owner Connection Channel Owner Connection ──── reply(...) ──────────► Client A

Register action handlers

px.onAction((routes) => { 
  routes.on("get-user", async (ctx) => { 
    ctx.reply(user); 
  }); 
});

Registers one or more action handlers.

Each handler receives a context object containing:

  • from — the sender connection.
  • to — the original destination (connectionId or channelId).
  • payload — request payload.
  • date — request timestamp.
  • reply() — sends the response back to the caller.

Remove action handlers

px.offAction((routes) => {
  routes.off("get-user", handler);
});

Removes previously registered action handlers.