Choose a protocol
Each service names a protocol, so a hub knows whether it can use it. Use a registered name when one fits; the libraries type them, so a typo does not compile.
| You offer… | Protocol | Endpoint example | RustyFunPlayer does |
|---|---|---|---|
| The OpenFunscripter WebSocket API (media + scripts) | ofs-ws | ws://127.0.0.1:8080/ofs | Adds an OFS source and follows your playback. |
| OFS API plus device state and range edits | ofs-ws-extended and ofs-ws, same endpoint | ws://127.0.0.1:8080/ofs | Same, and reports its devices to you. See the guide. |
| A Buttplug server (like Intiface) | buttplug-ws | ws://127.0.0.1:12345 | Adds a Buttplug output. |
| VLC’s HTTP interface | vlc-http | http://127.0.0.1:8080 | Adds a VLC source. |
| MPC-HC / MPC-BE web interface | mpc-http | http://127.0.0.1:13579 | Adds an MPC source. |
| mpv’s JSON IPC socket | mpv-ipc | unix://127.0.0.1/run/user/1000/mpv.sock | Adds an mpv source. |
| A game that calls an EDI server | edi | http://127.0.0.1:5000/ | Serves EDI for the game. See the guide. |
| A TCode device on a serial port | tcode-serial | serial://127.0.0.1/dev/ttyACM0 | Adds a serial output. |
| A TCode device over WebSocket, TCP or UDP | tcode-ws, tcode-tcp, tcode-udp | ws://127.0.0.1:8000/ws | Registered; not offered by RustyFunPlayer yet. |
| Whirligig’s timecode server | whirligig-tcp | tcp://127.0.0.1:2000 | Registered; not offered by RustyFunPlayer yet. |
Endpoints must be absolute URLs on a loopback host (127.0.0.0/8 or [::1]), with a scheme that matches the protocol. The full table with schemes is in the specification.
Features
A service may list up to 16 features, short strings for optional capabilities a hub can check. Unknown features are ignored.
Your own protocol
If nothing fits, name it explicitly. The name becomes x-<vendor>-<name>; peers refuse any other unregistered name.
import { customProtocol } from "funlink";
const sync = customProtocol("acme", "sync-ws"); // "x-acme-sync-ws"
#![allow(unused)]
fn main() {
let sync = funlink::Protocol::custom("acme", "sync-ws")?; // x-acme-sync-ws
}
var sync = Protocol.Custom("acme", "sync-ws"); // x-acme-sync-ws
var sync = Protocol.custom("acme", "sync-ws"); // x-acme-sync-ws
// x-acme-sync-ws at ws://0.0.0.0:9000/sync; unregistered protocols name their scheme.
funlink.addService("x-acme-sync-ws", 9000, "/sync", nullptr, "ws");
funlink.services = [{"protocol": "x-acme-sync-ws", "endpoint": "ws://127.0.0.1:9000/sync"}]
Want a name registered? Open an issue with a short description and a link to the protocol’s documentation.