ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Own worker-local connections and isolate every group by Hub class.

Registry mutations contain no await points and run on the application's event loop. Delivery snapshots identifiers before awaiting network I/O. Replacing IConnectionManager is the extension point for distributed delivery; the default registry never crosses process or worker boundaries.

Method __init__ Initialize an empty registry with validated structural limits.
Async Method broadcast Encode once per codec and deliver through bounded concurrent workers.
Method connectionIds Snapshot ready connection identifiers in one Hub namespace.
Method get Look up a ready recipient without crossing an optional Hub boundary.
Method groupIds Snapshot ready group members without crossing Hub namespaces.
Method hub Return application-service client targets for a Hub namespace.
Method join Join an active or provisional connection to a bounded group set.
Method leave Remove membership idempotently and discard empty group entries.
Method register Own one provisional connection before its onConnect hook.
Method snapshot Snapshot all owned connections for bounded lifecycle shutdown.
Method unregister Release owned registry entries and every group reference.
Class Variable __slots__ Undocumented
Instance Variable _config Undocumented
Instance Variable _connections Undocumented
Instance Variable _groups Undocumented
Instance Variable _hubs Undocumented
Instance Variable _memberships Undocumented
Property config Return the immutable application limits used by Hub lifecycles.
Property connectionCount Return the number of owned, including provisional, connections.
Property groupCount Return the number of nonempty Hub-local groups.
def __init__(self, config: RealtimeConfig): (source)

Initialize an empty registry with validated structural limits.

Parameters
config:RealtimeConfigGroup and broadcast limits shared by this application.
Returns
NoneStore limits and initialize empty connection and membership maps.
async def broadcast(self, hub: type[Hub], connection_ids: tuple[str, ...], envelope: object) -> BroadcastResult: (source)

Encode once per codec and deliver through bounded concurrent workers.

Parameters
hub:type[Hub]Hub namespace restricting every recipient.
connection_ids:tuple[str, ...]Recipient identifiers selected by the application.
envelope:objectTyped or mapping envelope accepted by the selected Hub codecs.
Returns
BroadcastResultSuccessful and failed recipient counts; cancellation propagates.
Raises
TypeError, ValueErrorIf the payload cannot be encoded before delivery begins.
def connectionIds(self, hub: type[Hub]) -> tuple[str, ...]: (source)

Snapshot ready connection identifiers in one Hub namespace.

Parameters
hub:type[Hub]Owning Hub class.
Returns
tuple[str, ...]Current ready recipients; no connection objects are retained.
def get(self, connection_id: str, hub: type[Hub] | None = None) -> RealtimeConnectionLike | None: (source)

Look up a ready recipient without crossing an optional Hub boundary.

Parameters
connection_id:strIdentifier of the requested connection.
hub:type[Hub] | None, optionalRequired owning Hub class, or None to omit namespace filtering.
Returns
RealtimeConnectionLike | NoneReady, nonclosing connection in the requested namespace, or None.
def groupIds(self, hub: type[Hub], group: str) -> tuple[str, ...]: (source)

Snapshot ready group members without crossing Hub namespaces.

Parameters
hub:type[Hub]Owning Hub class.
group:strGroup name within that Hub.
Returns
tuple[str, ...]Current ready recipients of the named group.
Raises
ValueErrorIf the group name is invalid.
def hub(self, hub: type[Hub]) -> HubClients: (source)

Return application-service client targets for a Hub namespace.

Parameters
hub:type[Hub]Hub class whose clients should receive events or invocations.
Returns
HubClientsClient selectors without a connection-specific caller.
Raises
TypeErrorIf the supplied class is not a Hub subclass.
def join(self, connection_id: str, group: str): (source)

Join an active or provisional connection to a bounded group set.

Parameters
connection_id:strOwned connection, including one in its onConnect hook.
group:strHub-local group name, at most 256 characters.
Returns
NoneAdd membership without consuming another slot for repeated joins.
Raises
ValueErrorIf the group name is invalid.
ConnectionErrorIf this connection is absent or closing.
RuntimeErrorIf joining another group would exceed its configured limit.
def leave(self, connection_id: str, group: str): (source)

Remove membership idempotently and discard empty group entries.

Parameters
connection_id:strConnection whose membership is being released.
group:strHub-local group name.
Returns
NoneRemove the membership if still owned.
Raises
ValueErrorIf the group name is invalid.
def register(self, connection: RealtimeConnectionLike): (source)

Own one provisional connection before its onConnect hook.

Parameters
connection:RealtimeConnectionLikeConnection with a cryptographically generated unique identifier.
Returns
NoneRegister the connection, its Hub namespace and empty memberships.
Raises
ValueErrorIf its identifier is invalid or already belongs to a connection.
def snapshot(self) -> tuple[RealtimeConnectionLike, ...]: (source)

Snapshot all owned connections for bounded lifecycle shutdown.

Returns
tuple[RealtimeConnectionLike, ...]Active and provisional connections owned at the time of the call.
def unregister(self, connection: RealtimeConnectionLike): (source)

Release owned registry entries and every group reference.

Parameters
connection:RealtimeConnectionLikeExact connection instance to release; repeated release is harmless.
Returns
NoneRemove ownership without touching an instance that reused an ID.

Undocumented

_connections: dict[str, RealtimeConnectionLike] = (source)

Undocumented

Undocumented

Undocumented

_memberships: dict[str, set[str]] = (source)

Undocumented

config: RealtimeConfig = (source)

Return the immutable application limits used by Hub lifecycles.

Returns
RealtimeConfigApplication-wide invocation, group and broadcast limits.
connectionCount: int = (source)

Return the number of owned, including provisional, connections.

Returns
intNumber of registered connections regardless of readiness.

Return the number of nonempty Hub-local groups.

Returns
intNumber of groups with at least one registered member.