Port Authority

About this site

This site started with an idea I have not been able to put down since 2011: sites should be able to link to each other's functionality the way they link to each other's pages.

It turned into a set of experiments in what a MessagePort can do, and where it stops.

How it started

In 2011 I worked on Web Intents with Greg Billock and James Hawkins. It was a way for a site to say “I want to do this, which site can help?”, and for you to pick the site. Share, edit, pick, save for later. It was Android Intents for the web.

It got pulled. The user interface is what killed it, most of all on desktop. The way we had designed the API meant we could not fix the interface without changing the API underneath, and by the time we understood that, it was too late. It was my first big project failure, and it hurt. I wrote down what happened.

I never got over it. I still think there is a real problem on the web. We build silos that keep you on one site. We have links that take you to another page, but we do not link our services the way we link our pages.

A middle-man that returns a port

In 2017 Surma, on my team, and Ian Kilpatrick were working on a polyfill for the Tasklets API. Buried inside it was a tidy way to call code in a worker without writing any postMessage code. I asked Surma if he could pull that part out. A couple of hours later he had Comlink.

Comlink passes transferable objects across where it can, and a MessagePort is transferable. That gave me the idea this whole site is built on. A site in the middle keeps a list of services and where they live. You ask it for a service, and it hands you back a port. You do not care where the port came from, and the site in the middle does not have to stay.

I wrote that up as Reinventing Web Intents. It was an experiment, not a solution.

Why I came back to it

I made this site while exploring where the web meets AI. Two things brought the old idea back.

The first was API keys. A page that calls a model has to hold a key, and anything in that page can read it. In 2025 I wrote that calling APIs from the browser shouldn't mean exposing keys. I wanted to call a model from a page without leaking a key. A port is one answer. The page that holds the key and the page that uses the model do not have to be the same page. That became the AI router.

The second was WebMCP. A site can list the tools it has, and an agent can find them and call them. With Web Intents, getting sites to say what they could do was hard, and we solved that part too late. WebMCP gives sites a way to say it, and someone, ideally you, can keep the index. I wrote WebMCP is the new Web Intents ... maybe, built webmcp-relay to keep a registry of the tools pages offer, and then wrote I think I've got it.

  1. Web Intents, service discovery for the web
  2. Reinventing Web Intents, a middle-man that returns a port
  3. Calling APIs from the browser shouldn't mean exposing keys
  4. WebMCP is the new Web Intents ... maybe, I think I've got it, Extensible web apps, and this site

From one hub to the rest of the site

The first thing I built here was the hub. It is Web Intents with a port at the end, one registry of every site's tools, and a way to use your own agent on any website.

Then I kept asking what else a port could do. Can it drive native plugin UI without an iframe, a stream or a signing key? Can it outlive the site that made the introduction, or its own page reloading? Can it reach a service worker, the audio thread or another device? What can be sent where, and in which browser?

The answers became the port patterns, each with a demo you can run and code you can copy. The guide explains ports from the start. Comlink today looks at what a library like Comlink can do on the platform as it is now, with a rewrite I call Hawser. What is missing is my list for browser vendors, each item with evidence.

The AI router grew the most. It has an address of its own, llmchannel.dev, a chat app that uses it, and the whole pattern written down, one step at a time.

Every experiment here is to find out what ports can do. That includes the places where they break.

Things you can take

There is no framework or bundler on this site, so the scripts you read are the ones that run. They are served so that another site can load them.

  • Port patterns

    Each pattern has a page of its own: a demo you can run, how it works, the code, and the traps.

  • Hawser

    Remote objects over a MessagePort, in one file with no dependencies: /hawser.js. Calls fail when the other side goes away, and a port can be narrowed before it is handed on.

  • The AI router

    One script gives a site a model on the visitor's own account. The site sends prompts down a port and never sees a key.

  • The hub

    /hub.js is the client library: serve(), pick(), registry(), agent() and intentLinks().

  • The guide

    Ports from the beginning, with diagrams you step through. Start here if a MessageChannel is new to you.

  • Further reading

    Everything I found on message channels and ports: reference pages, specifications, articles, libraries and talks.

Who built it and how it works

I'm Paul Kinlan. I lead the Chrome and Open Web Developer Relations team at Google, and I have been working on the web for a long time. This is my own playground of experiments and demos. It is not official Chrome documentation.

I write about the web at paul.kinlan.me, and about the web and AI at aifoc.us.

There is no framework and no bundler. Every page is hand-written HTML and ES modules. Where a demo says “site”, it means a site that really is separate: this one, a florist, a library, a planner and the router, each at an address of its own. The same Cloudflare Worker code serves all of them. The server keeps what has to be seen from everywhere, such as the hub's registry and the lab's results; the AI router keeps nothing on the server.

When something did not work, or worked in one browser and not in another, I wrote it down. It is in what browsers reported to the lab, and in What is missing.

Browser support

MessageChannel and MessagePort are in every browser, and have been for years. Many experiments here go further and use newer things, and not every browser has them. The lab runs each check in your own browser, and its results page shows what other browsers reported.