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

Execute a precompiled Hub using the existing application and scopes.

Async Static Method _error Send a controlled error without exposing application exception text.
Method __init__ Compile trusted Hub metadata before accepting network messages.
Method _bindContext Publish connection primitives into an independent scope.
Async Method _buildHub Construct a fresh Hub and attach its scoped connection primitives.
Async Method _disconnect Run the final hook without allowing it to prevent socket cleanup.
Async Method _invoke Execute one remote method inside its own contextvars-backed scope.
Async Method _receive Keep the sole reader available while invocations execute concurrently.
Async Method _startInvocation Validate admission before allocating an invocation task.
Async Method _stream Deliver each item before advancing the producer and close its iterator.
Async Method serve Run one Hub connection and release all resources before returning.
Class Variable __slots__ Undocumented
Instance Variable _app Undocumented
Instance Variable _dispatch Undocumented
Instance Variable _hub Undocumented
Instance Variable _manager Undocumented
Instance Variable _protocol Undocumented
async def _error(connection: RealtimeConnection, invocation_id: str, code: str, *, streaming: bool = False): (source)

Send a controlled error without exposing application exception text.

Parameters
connection:RealtimeConnectionResponse destination.
invocation_id:strPreviously validated correlation ID.
code:strStable error classification.
streaming:bool, optionalWhether to terminate a stream instead of a scalar invocation.
Returns
NoneRelease active invocation ownership and send a terminal error, or skip delivery when the connection is closing or already closed.
Raises
ConnectionErrorIf connection cleanup starts before the write acquires ownership.
asyncio.CancelledErrorIf terminal error delivery is cancelled.
def __init__(self, app: IApplication, manager: IConnectionManager, hub: type[Hub], protocol: str = 'json'): (source)

Compile trusted Hub metadata before accepting network messages.

Parameters
app:IApplicationExisting application and dependency container.
manager:IConnectionManagerShared worker-local registry and targeting service.
hub:type[Hub]Application-declared Hub class.
protocol:str, optionalJSON or MessagePack selected by the route.
Returns
NoneStore runtime dependencies and compile dispatch and codec metadata.
Raises
TypeErrorIf the Hub class, remote descriptors or annotations are unsupported.
ValueErrorIf remote names, aliases, protocol or message size are invalid.
def _bindContext(self, scope: ScopeManager, connection: RealtimeConnection): (source)

Publish connection primitives into an independent scope.

Parameters
scope:ScopeManagerActive connection or invocation scope.
connection:RealtimeConnectionOwner of network state.
Returns
NoneRegister the socket, context, connection, client and group proxies, and HTTP kernel marker in the supplied scope.
async def _buildHub(self, connection: RealtimeConnection) -> Hub: (source)

Construct a fresh Hub and attach its scoped connection primitives.

Parameters
connection:RealtimeConnectionConnection used for lifecycle and client targeting.
Returns
HubFresh instance with constructor injection resolved.
async def _disconnect(self, connection: RealtimeConnection, code: int, reason: str): (source)

Run the final hook without allowing it to prevent socket cleanup.

Parameters
connection:RealtimeConnectionAlready unregistered connection.
code:intObserved or locally selected closure code.
reason:strPeer reason where available.
Returns
NoneBound the disconnect hook to five seconds, log hook failures and close the socket if it remains open.
Raises
asyncio.CancelledErrorIf the final hook or socket closure is cancelled.
async def _invoke(self, connection: RealtimeConnection, method: RemoteMethod, envelope: Invoke, auth: AuthenticationContext): (source)

Execute one remote method inside its own contextvars-backed scope.

Parameters
connection:RealtimeConnectionOwner of tasks and response delivery.
method:RemoteMethodBoot-compiled callable and binding metadata.
envelope:InvokeValidated client values, never executable metadata.
auth:AuthenticationContextFresh authentication context with independent authorization cache.
Returns
NoneResolve dependencies, execute the method and send its result or a sanitized error after invocation-scope cleanup.
Raises
asyncio.CancelledErrorIf the invocation is cancelled after attempting its error response.
async def _receive(self, connection: RealtimeConnection) -> tuple[int, str]: (source)

Keep the sole reader available while invocations execute concurrently.

Parameters
connection:RealtimeConnectionReady connection with finite owned task registries.
Returns
tuple[int, str]Peer close code and reason, or (1000, "") when local reading stops.
Raises
ProtocolErrorIf decoding fails or an active invocation identifier is reused.
WebSocketDisconnectedIf socket operations report a disconnected peer.
asyncio.CancelledErrorIf the connection reader is cancelled.
async def _startInvocation(self, connection: RealtimeConnection, envelope: Invoke): (source)

Validate admission before allocating an invocation task.

Parameters
connection:RealtimeConnectionConnection owning the invocation ID namespace.
envelope:InvokeStructurally validated client invocation.
Returns
NoneRegister an admitted invocation task or send a controlled rejection.
Raises
ProtocolErrorIf an active invocation ID is reused.
async def _stream(self, connection: RealtimeConnection, invocation_id: str, source: AsyncIterable[object]): (source)

Deliver each item before advancing the producer and close its iterator.

Parameters
connection:RealtimeConnectionConnection providing natural send backpressure.
invocation_id:strCorrelation ID selected at admission.
source:AsyncIterable[object]Application-produced asynchronous stream.
Returns
NoneSend correlated stream items and await iterator closure when an aclose method is available.
Raises
TypeError, ValueErrorIf a stream item cannot be encoded by the selected codec.
ConnectionErrorIf connection cleanup has started during delivery.
asyncio.CancelledErrorIf streaming is cancelled while producing, sending or closing.
async def serve(self, socket: WebSocket): (source)

Run one Hub connection and release all resources before returning.

Parameters
socket:WebSocketSocket already registered in a kernel connection scope.
Returns
NoneRun connection hooks and message handling, then release owned work, registry membership and socket resources.
Raises
RuntimeErrorIf called without the application's active connection scope.
asyncio.CancelledErrorIf the connection owner is cancelled without a recorded failure.
__slots__: tuple[str, ...] = (source)

Undocumented

Undocumented

_dispatch = (source)

Undocumented

Undocumented

_manager = (source)

Undocumented

_protocol = (source)

Undocumented