Selkies
Developer Referencestream_server

BaseStreamingService

Interface a streaming service (websockets or webrtc) implements so the supervisor can start, stop, and route to either interchangeably.

Attributes

attributemode
= name

Functions

constructor__init__(name) -> None
Source Code
def __init__(self, name: str) -> None:
    self.mode = name
paramnamestr

Returns

None
funcstart() -> None

Set up resources and run the service's loops until stopped.

Source Code
@abstractmethod
async def start(self) -> None:
    """Set up resources and run the service's loops until stopped."""

Returns

None
funcstop() -> None

Clean up resources and stop the service's loops.

Source Code
@abstractmethod
async def stop(self) -> None:
    """Clean up resources and stop the service's loops."""

Returns

None
funcregister_routes(api_prefix, main_router) -> None

Register the service's absolute paths directly on the main router.

Source Code
@abstractmethod
def register_routes(self, api_prefix: str, main_router: web.UrlDispatcher) -> None:
    """Register the service's absolute paths directly on the main router.

    Args:
        api_prefix: Deployment subfolder prefix (empty when serving at root).
        main_router: The application's router to register routes on.
    """
    pass
paramapi_prefixstr

Deployment subfolder prefix (empty when serving at root).

parammain_routerweb.UrlDispatcher

The application's router to register routes on.

Returns

None
funcannounce_print_document(name, size) -> None

Tell the controller pages that name waits in the print spool.

Source Code
@abstractmethod
async def announce_print_document(self, name: str, size: int) -> None:
    """Tell the controller pages that `name` waits in the print spool."""
paramnamestr
paramsizeint

Returns

None
funcsessions() -> List[Dict[str, Any]]

The pages connected to this transport: id, transport, role, slot, display, connected_at and rtt_ms, the same keys on both.

Source Code
@abstractmethod
async def sessions(self) -> List[Dict[str, Any]]:
    """The pages connected to this transport: `id`, `transport`, `role`,
    `slot`, `display`, `connected_at` and `rtt_ms`, the same keys on both."""

Returns

typing.List[typing.Dict[str, typing.Any]]
funcdisconnect_session(session_id) -> bool

Close the page id names; False when it is not connected here.

Source Code
@abstractmethod
async def disconnect_session(self, session_id: str) -> bool:
    """Close the page `id` names; False when it is not connected here."""
paramsession_idstr

Returns

bool
funcuplink_session_conns() -> List[Tuple[Any, Optional[str], Optional[str]]]

(websocket, session token, peer ip) per connected client session, for upload uplink gauging (UplinkGauge).

The websocket must send ping() frames, and the service's message loop must run with autoping off, answer PING itself, and hand every PONG to note_pong — the gauge's clock is dead without that. Both transports implement this; an upload gauged on one side but not the other is a parity bug. Default: nothing to gauge.

Source Code
def uplink_session_conns(self) -> List[Tuple[Any, Optional[str], Optional[str]]]:
    """``(websocket, session token, peer ip)`` per connected client
    session, for upload uplink gauging (`UplinkGauge`).

    The websocket must send ``ping()`` frames, and the service's message
    loop must run with autoping off, answer PING itself, and hand every
    PONG to `note_pong` — the gauge's clock is dead without that. Both
    transports implement this; an upload gauged on one side but not the
    other is a parity bug. Default: nothing to gauge.
    """
    return []

Returns

typing.List[typing.Tuple[typing.Any, typing.Optional[str], typing.Optional[str]]]

On this page

Edit on GitHub