Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Test your integration

Against RustyFunPlayer

  1. Install and start RustyFunPlayer and leave Settings → Funlink → Offer to connect running apps on.
  2. Start your app.
  3. Within 5 seconds a card appears: Your App is running. Connect to follow its playback? (the wording depends on the protocol).
  4. Click Connect. Your app’s state turns connected.

No card?

CheckFix
Your service’s protocolRustyFunPlayer offers only the protocols marked in Choose a protocol. Others answer unsupported.
A source is already playingHubs do not prompt while connected to a source. Disconnect it, or use Always connect.
You answered Never for this app earlierRemove it under Settings → Funlink → Never ask again.
The announcement is rejectedRead the error body; see Errors. The libraries reject invalid records before sending.
You announce from a browser pageRustyFunPlayer refuses web pages. Announce from Node.js, Electron’s main process or a native app.

On the local network

  1. In RustyFunPlayer, turn on Settings → Funlink → Find apps and devices on the local network.
  2. Let the firewall of the computer running RustyFunPlayer accept UDP ports 37420 and 5353. On NixOS, set programs.rustyfunplayer.funlinkLan.openFirewall = true.
  3. Start your app or device on another machine of the same network. The card names its address.

No card? Settings → Doctor shows whether RustyFunPlayer listens on the local network and how many apps and devices it hears. Wi-Fi access points with client isolation and guest networks drop multicast; enter the device’s address under Also ask these addresses instead. avahi-browse -rt _funlink._udp lists peers that announce over DNS-SD.

Without any hub

Run a hub of your own in a test and check that it finds your app. Set FUNLINK_PORT so tests do not meet a real hub on 37420–37429:

FUNLINK_PORT=37491 npm test

With FUNLINK_PORT set, hubs bind and peers send to that single port only. Java also reads the system property funlink.port.

A minimal TypeScript test:

import { announce, startHub } from "funlink";

process.env.FUNLINK_PORT = "37491";
const found = new Promise((resolve) => {
  void startHub({ name: "Test hub", supports: ["ofs-ws"],
    onEvent: (e) => e.type === "found" && resolve(e.peer) });
});
const peer = announce({ id: "test", name: "Test",
  services: [{ protocol: "ofs-ws", endpoint: "ws://127.0.0.1:8080/ofs" }] });
console.log(await found);
await peer.close();

By hand

See what a hub answers with curl:

curl -sS -X POST http://127.0.0.1:37420/funlink/v1/announce \
  -H 'Content-Type: application/json' \
  -d '{"id":"test","session":"abcdefgh","name":"Test","services":[{"protocol":"ofs-ws","endpoint":"ws://127.0.0.1:8080/ofs"}]}'

A 200 answer names the hub, the protocols it supports and your state. Try ports 37421 and up if another program holds 37420.

Once it works, add the badge to your app’s page.