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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cevitxe-signal-server

v0.4.2

Published

This server provides two services:

Downloads

11

Readme

🐟 cevitxe-signal-server

This server provides two services:

  • Introduction (aka discovery): A client can provide one or more document keys that they're interested in. If any other client is interested in the same key or keys, each will receive an Introduction message with the other's id. They can then use that information to connect.

  • Connection: Client A can request to connect with Client B on a given document ID. If we get matching connection requests from A and B, we just pipe their sockets together.

diagram

Running locally

From this monorepo, you can run this server as follows:

$ yarn start:signal-server

You should see something like thsi:

$ yarn start:signal-server
yarn run v1.19.0
$ yarn workspace cevitxe-signal-server start
$ node dist/start.js
🐟 Listening at http://localhost:8080

You can visit that URL with a web browser to confirm that it's working; you should see a big ol' fish emoji:

Deployment

The easiest way to stand one of these up is to use the cevitxe-signal-server-standalone repo, which is optimized for deployment. In that repo you'll find instructions for deploying to Heroku, AWS Elastic Beanstalk, Google Cloud Platform, and Glitch.

Usage

The client that we've written for this server is the easiest way to use it. See the instructions for cevitxe-signal-client for details.

API

The following documentation might be of interest to anyone working on cevitxe-signal-client, or replacing it with a new client. You don't need to know any of this to interact with this server if you're using the client.

This server has two WebSocket endpoints: introduction and connection.

Introduction endpoint: /introduction/:localId

  • I connect to this endpoint, e.g. wss://your.domain.com/introduction/aaaa4242.

    • :localId is my unique client identifier.
  • Once a WebSocket connection has been made, I send an introduction request containing one or more document IDs I'm interested in joining:

    {
      type: 'Join',
      join: ['happy-raccoon', 'hairy-thumb'], // documents I have or am interested in
    }
  • If another peer is connected to the same server and interested in one or more of the same documents IDs, the server sends me an introduction message:

    {
      type: 'Introduction',
      id: 'qrst7890', // the peer's id
      keys: ['happy-raccoon'] // documents we're both interested in
    }
  • I can now use this information to request a connection to this peer via the connection endpoint:

Connection endpoint: /connection/:localId/:remoteId/:key

Once I've been given a peer's ID, I make a new connection to this endpoint, e.g. wss://your.domain.com/connection/aaaa4242/qrst7890/happy-raccoon.

  • :localId is my unique client identifier.
  • :remoteId is the peer's unique client identifier.
  • :key is the document ID.

If and when the peer makes a reciprocal connection, e.g. wss://your.domain.com/connection/qrst7890/aaaa4242/happy-raccoon, the server pipes their sockets together and leaves them to talk.

The client and server don't communicate with each other via the connection endpoint; it's purely a relay between two peers.

License

MIT

Prior art

Inspired by https://github.com/orionz/discovery-cloud-server