pub struct GatewayServer { /* private fields */ }Expand description
Fully assembled machine gateway and its chat registry.
Implementations§
Source§impl GatewayServer
impl GatewayServer
Sourcepub async fn open(state_dir: PathBuf) -> Result<Self>
pub async fn open(state_dir: PathBuf) -> Result<Self>
Opens protected state and the machine-wide chat registry.
§Errors
Returns an error if the resource cannot be read, decoded, or validated.
Sourcepub async fn bootstrap(
state_dir: PathBuf,
listen: SocketAddr,
) -> Result<(Self, PairingGrant)>
pub async fn bootstrap( state_dir: PathBuf, listen: SocketAddr, ) -> Result<(Self, PairingGrant)>
Binds and initializes a fresh local gateway before exposing its one-use pairing grant.
§Errors
Returns an error if configuration is invalid or a required resource cannot be initialized.
Sourcepub async fn serve(self) -> Result<()>
pub async fn serve(self) -> Result<()>
Serves until shutdown or the configured idle interval (72 hours by default).
§Errors
Returns an error if validation or an operation required to complete the request fails.
Sourcepub async fn serve_until(self, shutdown: impl Future<Output = ()>) -> Result<()>
pub async fn serve_until(self, shutdown: impl Future<Output = ()>) -> Result<()>
Serves until shutdown or the same inactivity policy as Self::serve.
Signal shutdown and await this future to close connections, finish routine dispatch, and stop resident sessions through their normal cleanup. Merely dropping the future does not perform graceful shutdown.
§Errors
Returns an error if validation or an operation required to complete the request fails.
Sourcepub const fn listen_addr(&self) -> SocketAddr
pub const fn listen_addr(&self) -> SocketAddr
Returns the bound address from persisted configuration.