selkies
Token pushes to the selkies control plane.
Token pushes to the selkies control plane.
Selkies enforces input routing itself: it receives the full token map
{token: {role, slot, mk_control}} and decides per websocket connection
whether input goes to mouse/keyboard, a virtual gamepad slot, or nowhere. The
broker just keeps that map in sync with room state.
attributelog= logging.getLogger(__name__)funcbuild_token_map(session) -> dict[str, dict[str, Any]]Build the token map selkies routes input by, from the session's room state.
The controller keeps mouse and keyboard control unless a viewer has been
handed it; a viewer holds it only while they are the mk_owner_token.
paramsessiondict[str, Any]The active session dict.
Returns
dictA mapping of streaming token to {"role", "slot", "mk_control"}, one
func_token_urls() -> list[str]Return the candidate token endpoints, last-known-good first.
Returns
listThe configured endpoints, with _active_url moved to the front when it
funcpush_tokens(session) -> boolPOST the current token set to selkies.
Replaces the whole active set: removed tokens disconnect their clients, changed permissions apply live. Each candidate endpoint is tried in turn and the first to accept is remembered for next time.
paramsessiondict[str, Any]The active session dict the token map is built from.
Returns
boolTrue when an endpoint accepted the push, False when every candidate
funcclear_tokens() -> boolPush an empty token set so every streaming client is disconnected.
Returns
boolTrue when an endpoint accepted the empty set, False when every candidate