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

@vlcn.io/ws-client

v0.2.0

Published

A WebSocket client to do streaming database sync. Meant to be paired with the `@vlcn.io/ws-server` package or any server that speaks the same protocol.

Downloads

75

Readme

@vlcn.io/ws-client

A WebSocket client to do streaming database sync. Meant to be paired with the @vlcn.io/ws-server package or any server that speaks the same protocol.

Setup is pretty trivial as the React bindings support websocket sync. The vlcn vite starter uses WebSocket sync as well.

Setup

Create a Sync Worker

The sync worker file will be loaded and run in its own worker thread. The config will only change when moving between platforms (e.g., React Native vs Web vs Tauri vs Electron).

For web, the config looks like:

import { Config, defaultConfig } from "@vlcn.io/ws-client";
import { start } from "@vlcn.io/ws-client/worker.js";
// Interface to WASM sqlite
import { createDbProvider } from "@vlcn.io/ws-browserdb";

export const config: Config = {
  dbProvider: createDbProvider(),
  transportProvider: defaultConfig.transportProvider,
};

start(config);

Put that code in its own file such as sync-worker.ts.

Instantiate the SyncWorker

Somewhere in the bootstrapping of your application, create an instance of your worker. You should only do this once for your application. The sync worker can sync any number of databases you'd like so there's no need to create many sync workers.

The sync worker is also smart enough to coordinate between tabs and other workers. In other words, if many tabs are open on the same page and they all start the same worker, only one will actively sync a given database at a time.

import SyncWorker from "./sync-worker.js?worker";
const worker = new SyncWorker();

See App.tsx in the Vite starter.

Kick Off Sync

If you're using the React bindings this is pretty simple. Just call the useSync hook:

useSync({
  dbname,
  endpoint: `ws://host/sync`,
  room: dbname,
  worker,
});

See App.tsx in the Vite starter.