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

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

Returns

None
funcstart(self) -> 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."""
paramself

Returns

None
funcstop(self) -> 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."""
paramself

Returns

None
funcregister_routes(self, 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
paramself
paramapi_prefixstr

Deployment subfolder prefix (empty when serving at root).

parammain_routerweb.UrlDispatcher

The application's router to register routes on.

Returns

None
funcuplink_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.

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 []
paramself

Returns

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

On this page

Edit on GitHub