Skip to main content

start_on_localhost

Function start_on_localhost 

Source
pub async fn start_on_localhost(
    pool: S3ClientPoolHandle,
    registry: TokenRegistryHandle,
    session_id: String,
) -> Result<MediaServerHandle, AppError>
Expand description

Start the loopback media server and return a MediaServerHandle.

Binds to 127.0.0.1:0 (OS-assigned port), spawns the server on the current Tokio runtime, and returns immediately.

The caller is responsible for calling handle.shutdown.send(()) on app exit to stop the server, and calling registry.revoke_session(session_id) to sweep all live tokens.

ยงArguments

  • pool โ€” S3 client pool passed through to each request handler.
  • registry โ€” shared token registry.
  • session_id โ€” UUID v4 string minted at app start; tags all tokens.