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

web-request-rpc

v3.0.0

Published

Web Request RPC

Downloads

5,441

Readme

web-request-rpc

JSON-RPC for Web Request Polyfills

The RPC protocol used in this library relies on the use of postMessage and JSON-RPC. While it could potentially be made more general, it is currently targeted at building components that help implement "Web Request" polyfills.

A "Web request" is a catch all for a request made from a Web application (the relying party) that is fulfilled by another Web application (the service provider) that is typically from another origin. There are a number of different "Web requests" such as requests for payment, credentials, social information, or media. Each of these may have a Web API that is narrowly targeted (or includes specific features related to) at the specific type of request, however, each of them follow the same general model. This means some building blocks for creating polyfills for these sorts of "Web requests" can be shared.

Some of these building blocks are provided by this library.

Client

A Client is used to connect to an RPC Server.

TODO

Server

TODO:

WebAppContext

A WebAppContext loads or attaches to a window with a remote Web Application that typically runs on a cross domain website. It is used to manage and provide access this RPC WebApp. It also enables the WebApp to make some control calls, such as to show or hide its UI.

Use cases include:

  1. Loading and communicating with a "Web Request Mediator" that polyfills some missing feature in a user's Web browser that could not be polyfilled without the use of a cross-domain third party website. These features are typically modeled as some kind of request made by one website that will be fulfilled by a different website. The mediator plays the role that the browser would natively provide if it implemented the feature, namely to facilitate communication and interaction between these two sites to process and fulfill the request.
  2. Loading and communicating with a third party service provider Web application. A "Web Request Mediator" (see the first use case) would use a WebAppContext to load these Web applications to enable them to fulfill requests made by a relying party.

TODO: Add note about usefulness of passing a Promise for a window handle when creating/connecting with client/server/WebAppContext/etc. This approach enables a message listener to be attached prior to the creation of the window where access to the window handle is not available until the window has loaded. This is important to prevent missing messages.

WebApp

A Web Application that uses RPC to communicate with a WebAppContext that is loaded by another, typically cross domain, website. This Web Application could be a "Web Request Mediator" that will itself load WebApps, or an application designed to fulfill Web requests.