SealSkin
Server Reference

collaboration

Collaboration rooms: the room page, its WebSocket and token fan-out.

A collaboration session is a normal session whose container also runs a control plane that accepts a table of tokens (controller, viewers, gamepad slots, mouse/keyboard owner). This module serves the room page, relays chat and control messages between participants over a WebSocket and pushes token changes down to every container of the session.

attributelogger
= logging.getLogger(__name__)
attributerouter
= APIRouter()
attributeROOM_CONNECTIONSdict[str, dict[str, Any]]
= {}
attributeTOKEN_ENDPOINT_CACHEdict[str, str]
= {}
func_absolutize_room_assets(html) -> str

Rewrite relative asset references in the room template to /ui/room/.

The page is served at /room/<session_id> while its hashed assets live under the static /ui/room/ mount, so relative references would 404.

paramhtmlstr

Raw room template.

Returns

str

The template with relative src/href values made absolute.

funccollaborative_room(request, session_id, collab_token=Query(None, alias='token')) -> Response

Serve the collaboration room page.

Authenticates the visitor as controller (session access token or controller token), existing viewer, or new participant/read-only viewer via an invite token. New viewers get a personal token and are redirected.

paramrequestRequest

Incoming request.

paramsession_idUUID

Collaboration session id.

paramcollab_tokenstr | None
= Query(None, alias='token')

Controller, viewer or invite token.

Returns

fastapi.responses.Response

The room HTML, or a redirect for newly registered viewers.

funcbroadcast_token_state(session_id, session_data) -> None

Push the current token table to every container of a session.

paramsession_idstr

Session id.

paramsession_datadict[str, Any]

Session record.

Returns

None
func_owner_group(username) -> str

Return the effective group of a user ("none" when unknown).

paramusernamestr

Returns

str
funcbroadcast_to_room(session_id, payload) -> None

Send a JSON payload to every participant of a room.

paramsession_idstr
parampayloaddict[str, Any]

Returns

None
funcbroadcast_binary_to_room(session_id, payload, sender_ws) -> None

Relay a binary (audio/video) packet to every participant except the sender.

paramsession_idstr
parampayloadbytes
paramsender_wsWebSocket

Returns

None
funcroom_websocket(websocket, session_id) -> None

Handle a participant's WebSocket for the lifetime of the connection.

paramwebsocketWebSocket

The accepted socket.

paramsession_idUUID

Collaboration session id.

Returns

None
funcbroadcast_state(session_id) -> None

Send the participant list and designated speaker to the room.

paramsession_idstr

Returns

None
funchandle_assign_slot(session_id, viewer_token, slot) -> None

Assign a gamepad slot to a participant (or clear it with None).

paramsession_idstr
paramviewer_tokenstr
paramslotint | None

Returns

None
funchandle_assign_mk(session_id, target_token) -> None

Give mouse and keyboard control to a participant (None = controller).

paramsession_idstr
paramtarget_tokenstr | None

Returns

None
funcnotify_session_ended(session_id) -> None

Tell every participant that the session ended and drop the room.

paramsession_idstr

Returns

None