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

@signageos/forward-server-bridge

v0.1.0

Published

The service that allows serve static content from local machine into public

Readme

signageOS forward-server-bridge

The service allows forward HTTP requests into local machine port initiated by client and send responses back.

Server

Development

npm install
npm start

Configuration

| Environment Variable | Description | Default | |---|---|---| | FORWARDING_GRACE_PERIOD_MS | Grace period in milliseconds before cleaning up a disconnected forwarding session. During this period, the session can be resumed by reconnecting with the same forwardingUid. | 30000 (30s) |

CLI

The CLI binary allows you to forward HTTP requests from a public server to a local port with automatic reconnection.

Usage

npx @signageos/forward-server-bridge --local-port 3000 --server-url https://forward.example.com

Options

| Option | Required | Description | Default | |---|---|---|---| | --local-port <port> | Yes | Local port to forward traffic to | — | | --server-url <url> | Yes | Public URL of the forward server | — | | --local-hostname <hostname> | No | Local hostname to forward traffic to | localhost | | --forwarding-uid <uid> | No | Forwarding UID for session recovery (reuse a previous session) | — | | --max-retries <count> | No | Maximum number of reconnection retries | Infinity | | --retry-delay <ms> | No | Initial retry delay in milliseconds (exponential backoff: 2x multiplier, 30s cap) | 1000 |

The CLI outputs only the public URL to stdout (machine-readable). Reconnection logs are written to stderr.

Connection Recovery

If the WebSocket connection drops, the CLI automatically reconnects with exponential backoff and preserves the same public URL. The server keeps the forwarding session alive during the grace period (FORWARDING_GRACE_PERIOD_MS), so incoming requests during a brief disconnect receive a 503 Service Unavailable response instead of 404 Not Found.

Client SDK

Usage

import { forward } from '@signageos/forward-server-bridge/dist/client';
const { publicUrl, forwardingUid, disconnected, isConnected, onConnectionStateChange, stop } = await forward({
	localPort: 9080, // Required. Port where the public traffic will be forwarded to.
	serverUrl: 'https://localhost:8080', // Required. Public URL (including scheme & port) of the forward server.
	localHostname: 'localhost', // Optional. Hostname where the public traffic will be forwarded to. Default: 'localhost'.
	forwardingUid: 'abc1234', // Optional. Forwarding UID to resume a previous session.
});
console.log(`You can access the forwarded server on ${publicUrl}`);
console.log(`Session ID: ${forwardingUid}`); // Save this to reconnect later.
await disconnected; // Resolves when the socket disconnects (for any reason).
await stop(); // Stop forwarding.

Auto-Reconnecting Mode

For automatic reconnection with exponential backoff, pass maxRetries to forward():

import { forward } from '@signageos/forward-server-bridge/dist/client';

const forwarding = await forward({
	localPort: 9080,
	serverUrl: 'https://localhost:8080',
	localHostname: 'localhost', // Optional. Default: 'localhost'.
	forwardingUid: 'abc1234', // Optional. Resume a previous session.
	maxRetries: Infinity, // Optional. 0 (default) disables auto-reconnect.
	retryDelay: 1000, // Optional. Initial retry delay in ms. Default: 1000.
});

console.log(`Public URL: ${forwarding.publicUrl}`);
console.log(`Session ID: ${forwarding.forwardingUid}`);

forwarding.onConnectionStateChange((connected) => {
	console.log(`Connection state: ${connected ? 'connected' : 'disconnected'}`);
});

await forwarding.disconnected; // Resolves when retries are exhausted or stop() is called.
await forwarding.stop();

Process

Once the client forward is established, the server accepts HTTP requests on returned publicUrl and forwards them to the localPort on the localHostname.

The logic creates the WebSocket tunnel under the hood initiated from client side to the serverUrl. So it can be called even from a computer that has firewall on incoming connections.

sequenceDiagram
	participant PublicUser
	participant ForwardingServer
	participant LocalClient
	Note right of LocalClient: Local machine initiates the forwarding
	LocalClient->>ForwardingServer: Establish WebSocket tunnel
	Note left of ForwardingServer: Publicly accessible "publicUrl" endpoint.<br> E.g.: `http://forward.example.com/43fea3c24/`
	PublicUser->>ForwardingServer: Forward request
	Note right of ForwardingServer: "serverPort" is listening
	ForwardingServer->>LocalClient: Forward request
	Note right of LocalClient: "localPort" is listening
	Note right of LocalClient: Optionally "localHostname" is listening
	LocalClient->>ForwardingServer: Forward response
	ForwardingServer->>PublicUser: Forward response

Motivation

This feature can be used to allow some local service to be accessible from the internet. Even if the local machine doesn't have public interface (hidden in private network behind the router). Only the forward server needs to be accessible publicly from the internet.