snapcast-server 0.3.1

Snapcast server library — embeddable synchronized multiroom audio server
Documentation

Snapcast server library — embeddable synchronized multiroom audio server.

See also: snapcast-client for the client library.

Architecture

The server is built around a channel-based API matching snapcast-client:

  • [SnapServer] is the main entry point
  • [ServerEvent] flows from server → consumer (client connected, stream status, custom messages)
  • [ServerCommand] flows from consumer → server (typed mutations, custom messages, stop)

Example

use snapcast_server::{SnapServer, ServerConfig, ServerEvent, ServerCommand};

# async fn example() -> anyhow::Result<()> {
let config = ServerConfig::default();
let (mut server, mut events, _audio_tx) = SnapServer::new(config);
let cmd = server.command_sender();

tokio::spawn(async move {
    while let Some(event) = events.recv().await {
        match event {
            ServerEvent::ClientConnected { id, name } => {
                tracing::info!(id, name, "Client connected");
            }
            _ => {}
        }
    }
});

server.run().await?;
# Ok(())
# }