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 connection and Hub-local group registries with validated limits. |
| Async Method | broadcast |
Broadcast an envelope with per-codec encoding and bounded concurrency. |
| Method | connection |
Snapshot ready, nonclosing connection identifiers in one Hub namespace. |
| Method | get |
Return a ready, nonclosing connection within an optional Hub namespace. |
| Method | group |
Snapshot ready, nonclosing group members within one Hub namespace. |
| Method | hub |
Create application-service client selectors for one Hub class. |
| Method | join |
Join a nonclosing owned connection to a Hub-local group. |
| Method | leave |
Remove an owned membership and discard empty Hub-local groups. |
| Method | register |
Register a connection and its initial Hub-local membership state. |
| Method | snapshot |
Return all currently owned connections for lifecycle coordination. |
| Method | unregister |
Remove one owned connection and all of its group memberships. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _config |
Group and broadcast limits shared by this application. |
| Instance Variable | _connections |
Active realtime connections indexed by identifier. |
| Instance Variable | _groups |
Realtime group membership and targeting interface. |
| Instance Variable | _hubs |
Hub registrations associated with active connections. |
| Instance Variable | _memberships |
Group memberships indexed by connection identifier. |
| Property | config |
Return the application-wide realtime configuration. |
| Property | connection |
Count registered connections regardless of readiness or closing state. |
| Property | group |
Count nonempty groups across all Hub namespaces. |
Initialize connection and Hub-local group registries with validated limits.
| Parameters | |
config:orionis.realtime.config.RealtimeConfig | Realtime limits shared by connections and broadcast workers. |
| Returns | |
None | Retain configuration and create empty connection and membership indexes. |
type[ Hub], connection_ids: tuple[ str, ...], envelope: object) -> BroadcastResult:
(source)
¶
Broadcast an envelope with per-codec encoding and bounded concurrency.
| Parameters | |
hub:type[orionis.realtime.Hub] | Exact Hub namespace restricting every recipient. |
connectiontuple[str, ...] | Recipient identifier occurrences to attempt, without deduplication. |
envelope:object | Protocol envelope accepted by the selected connection codecs. |
| Returns | |
orionis.realtime.BroadcastResult | Aggregate sent and failed counts, including unavailable recipients as failures. Empty input returns zero counts. |
| Raises | |
TypeError, ValueError | If encoding fails before recipient delivery starts. |
asyncio.CancelledError | If delivery is cancelled; admitted connection-owned writes may finish independently. |
Snapshot ready, nonclosing connection identifiers in one Hub namespace.
| Parameters | |
hub:type[orionis.realtime.Hub] | Exact owning Hub class whose recipients should be selected. |
| Returns | |
tuple[str, ...] | Ready recipient IDs at the time of the call; an unknown Hub produces an empty tuple. |
str, hub: type[ Hub] | None = None) -> RealtimeConnectionLike | None:
(source)
¶
Return a ready, nonclosing connection within an optional Hub namespace.
| Parameters | |
connectionstr | Registered connection identifier to resolve. |
hub:type[orionis.realtime.Hub] or None, optional | Exact owning Hub class, or None to disable namespace filtering. |
| Returns | |
orionis.realtime.contracts.connection.RealtimeConnectionLike or None | Ready, nonclosing connection, or None for absent, unready, closing, or differently namespaced entries. |
Snapshot ready, nonclosing group members within one Hub namespace.
| Parameters | |
hub:type[orionis.realtime.Hub] | Exact Hub class owning the requested group. |
group:str | Group name within the selected Hub namespace. |
| Returns | |
tuple[str, ...] | Ready member IDs at the time of the call, or an empty tuple for an unknown Hub or group. |
| Raises | |
ValueError | If the group name is invalid. |
Create application-service client selectors for one Hub class.
| Parameters | |
hub:type[orionis.realtime.Hub] | Hub class defining the recipient namespace. |
| Returns | |
orionis.realtime.HubClients | Selectors without a connection-specific caller, suitable for services. |
| Raises | |
TypeError | If the supplied value is not a Hub class. |
Join a nonclosing owned connection to a Hub-local group.
| Parameters | |
connectionstr | Registered connection identifier, including provisional connections. |
group:str | Group name within the connection's owning Hub namespace. |
| Returns | |
None | Add membership, leaving repeated joins unchanged without using capacity. |
| Raises | |
ValueError | If the group name is invalid. |
ConnectionError | If the connection is absent or closing. |
RuntimeError | If adding a membership would exceed the connection's configured limit. |
Remove an owned membership and discard empty Hub-local groups.
| Parameters | |
connectionstr | Connection whose membership should be removed, if still registered. |
group:str | Valid group name in the connection's Hub namespace. |
| Returns | |
None | Discard owned membership; ignore absent IDs and repeated leaves. |
| Raises | |
ValueError | If the group name is invalid. |
Register a connection and its initial Hub-local membership state.
| Parameters | |
connection:orionis.realtime.contracts.connection.RealtimeConnectionLike | Connection with a valid identifier not already owned by this worker. |
| Returns | |
None | Retain the connection and initialize its Hub and membership indexes. |
| Raises | |
ValueError | If the identifier is invalid or already belongs to a registered connection. |
Return all currently owned connections for lifecycle coordination.
| Returns | |
tuple[orionis.realtime.contracts.connection.RealtimeConnectionLike, ...] | Registered connection references, including provisional and closing ones, at the time of the call. |
Remove one owned connection and all of its group memberships.
| Parameters | |
connection:orionis.realtime.contracts.connection.RealtimeConnectionLike | Exact registered instance; ignore absent or replaced instances. |
| Returns | |
None | Remove its registry and Hub entries and discard empty groups without affecting another instance that reused the identifier. |
Return the application-wide realtime configuration.
| Returns | |
orionis.realtime.config.RealtimeConfig | Invocation, client-result, group, and broadcast limits used by the manager. |
Count registered connections regardless of readiness or closing state.
| Returns | |
int | Number of owned entries, including provisional and closing connections. |