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 ConnectionManager(IConnectionManager): (source)
Constructor: ConnectionManager(config)
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 | connection |
Snapshot ready connection identifiers in one Hub namespace. |
| Method | get |
Look up a ready recipient without crossing an optional Hub boundary. |
| Method | group |
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 | connection |
Return the number of owned, including provisional, connections. |
| Property | group |
Return the number of nonempty Hub-local groups. |
Initialize an empty registry with validated structural limits.
| Parameters | |
config:RealtimeConfig | Group and broadcast limits shared by this application. |
| Returns | |
None | Store limits and initialize empty connection and membership maps. |
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. |
connectiontuple[str, ...] | Recipient identifiers selected by the application. |
envelope:object | Typed or mapping envelope accepted by the selected Hub codecs. |
| Returns | |
BroadcastResult | Successful and failed recipient counts; cancellation propagates. |
| Raises | |
TypeError, ValueError | If the payload cannot be encoded before delivery begins. |
str, hub: type[ Hub] | None = None) -> RealtimeConnectionLike | None:
(source)
¶
Look up a ready recipient without crossing an optional Hub boundary.
| Parameters | |
connectionstr | Identifier of the requested connection. |
hub:type[Hub] | None, optional | Required owning Hub class, or None to omit namespace filtering. |
| Returns | |
RealtimeConnectionLike | None | Ready, nonclosing connection in the requested namespace, or None. |
Return application-service client targets for a Hub namespace.
| Parameters | |
hub:type[Hub] | Hub class whose clients should receive events or invocations. |
| Returns | |
HubClients | Client selectors without a connection-specific caller. |
| Raises | |
TypeError | If the supplied class is not a Hub subclass. |
Join an active or provisional connection to a bounded group set.
| Parameters | |
connectionstr | Owned connection, including one in its onConnect hook. |
group:str | Hub-local group name, at most 256 characters. |
| Returns | |
None | Add membership without consuming another slot for repeated joins. |
| Raises | |
ValueError | If the group name is invalid. |
ConnectionError | If this connection is absent or closing. |
RuntimeError | If joining another group would exceed its configured limit. |
Remove membership idempotently and discard empty group entries.
| Parameters | |
connectionstr | Connection whose membership is being released. |
group:str | Hub-local group name. |
| Returns | |
None | Remove the membership if still owned. |
| Raises | |
ValueError | If the group name is invalid. |
Own one provisional connection before its onConnect hook.
| Parameters | |
connection:RealtimeConnectionLike | Connection with a cryptographically generated unique identifier. |
| Returns | |
None | Register the connection, its Hub namespace and empty memberships. |
| Raises | |
ValueError | If its identifier is invalid or already belongs to a connection. |
Snapshot all owned connections for bounded lifecycle shutdown.
| Returns | |
tuple[RealtimeConnectionLike, ...] | Active and provisional connections owned at the time of the call. |
Release owned registry entries and every group reference.
| Parameters | |
connection:RealtimeConnectionLike | Exact connection instance to release; repeated release is harmless. |
| Returns | |
None | Remove ownership without touching an instance that reused an ID. |
Return the immutable application limits used by Hub lifecycles.
| Returns | |
RealtimeConfig | Application-wide invocation, group and broadcast limits. |
Return the number of owned, including provisional, connections.
| Returns | |
int | Number of registered connections regardless of readiness. |