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

rpcpeering

v0.1.0

Published

A user-centric app interoperation protocol for establishing RPC connections between apps

Downloads

70

Readme

RPC Peering

RPC Peering is a user-centric app interoperation protocol.

It allows an app (the initiator) to request a user to connect it to another app (the responder) that supports the required RPC interface.

For example:

  • A Web3 app can request the user to connect it to a Wallet app that supports the Ethereum JSON-RPC API interface.
  • A note taking app can request to connect to an LLM that supports the Ollama HTTP API interface.
  • An AI chat bot app can request to connect to some upstream app that supports a certain GRPC API interface.

How It Works

Let's assume the initiator app is a crypto portfolio tracker and it wants to connect to a responder app that supports the Ethereum JSON-RPC API.

  1. The initiator app creates a Peering URI with the topic ethereum and its peering server URL.
import { PeeringURI } from 'rpcpeering';

// Create a peering URI that will tell the responder app to connect to the initiator's peering server
const peeringUri = new PeeringURI(
  'https://portfolio-tracker.example.com/rpcpeering', // The URL of the initiator's peering server
  'ethereum', // The topic the responder app must support
);
// The peering URI string is:
// `rpcpeering+ethereum:${encodeURIComponent('https://portfolio-tracker.example.com/rpcpeering')}`

// Display the peering URI to the user in a QR code so they can scan it with their waller app
  1. The user scans the QR code with their wallet app, which opens the peering URI in the responder wallet app. The wallet app sends a session proposal to the initiator's peering server.
{
  "url": "https://wallet.example.com/rpcpeering/ethereum", // The URL of the responder's Ethereum JSON-RPC API
  "advertise": ["ethereum", "solana"], // The topics the responder app supports. Here, the responder advertises to the tracker app that it also supports the Solana JSON-RPC API.
}
  1. The initiator's peering server evaluates the session proposal. If the proposal is accepted, the initiator sends its own session proposal to the responder's peering server.
{
  "url": "https://portfolio-tracker.example.com/rpcpeering/ethereum", // The URL of the initiator's Ethereum callback API, where the responder can send callback requests
  "advertise": ["ethereum", "solana"], // The topics the initiator app supports. Here, the initiator advertises to the wallet app that it also supports the Solana JSON-RPC API.
}
  1. The initiator and responder can now send Ethereum JSON-RPC requests to each other over the URLs specified in their session proposals.