Errors
A hub answers a bad request with an HTTP status and a JSON body:
{ "code": "invalid_announce", "message": "services[0].endpoint must use a loopback host" }
The libraries raise the same codes (FunlinkError, funlink::Error, FunlinkException).
| Code | Status | Cause | Fix |
|---|---|---|---|
invalid_announce | 400 | The record breaks a rule; the message names the field. | Check the record limits. Common: endpoint not on 127.0.0.1, wrong scheme for the protocol, id with spaces, unregistered protocol name without x-. |
forbidden | 403 | The Host or Origin header was refused. | Send to 127.0.0.1, not a LAN address. Web pages are refused by hubs that do not accept browsers. |
not_found | 404 | Unknown path or version. | Use /funlink/v1/announce and /funlink/v1/bye. |
too_large | 413 | Body over 96 KiB. | Shrink the icon (≤ 64 KiB) or ext. |
rate_limited | 429 | Same id less than 200 ms apart, or more than 64 apps. | Announce every 5 s; the libraries pace themselves. |
no_port | – | Library only: all ports 37420–37429 are taken, so a hub cannot start. | Close another hub, or set FUNLINK_PORT. |
Connection refused on a port just means no hub listens there; ignore it.