Connection Contracts¶
Nalix.Common.Networking defines the contracts shared by the network runtime and higher-level application code.
Source mapping¶
src/Nalix.Common/Networking/IConnection.cssrc/Nalix.Common/Networking/IConnection.Hub.cssrc/Nalix.Common/Networking/IConnection.Transmission.cssrc/Nalix.Common/Networking/IProtocol.cs
Main types¶
IConnectionIConnectionHubIProtocol
IConnection¶
IConnection is the shared connection contract.
It exposes:
- connection identity
- endpoint information
- connection metrics such as uptime and bytes sent
- crypto state such as
SecretandAlgorithm - lifecycle events
- close and disconnect operations
IConnectionHub¶
IConnectionHub is the shared connection registry contract.
It supports:
- lookup by ID
- register and unregister
- listing active connections
- association helpers such as username binding
- close-all operations
IProtocol¶
IProtocol is the shared protocol contract.
It supports:
OnAccept(...)ProcessMessage(...)PostProcessMessage(...)KeepConnectionOpen
Example¶
IConnection connection = hub.GetConnection(connectionId);
await connection.TCP.SendAsync(packet, ct);
IProtocol protocol = new SampleProtocol();
await protocol.OnAccept(connection, ct);