Snapcast.Session (Snapcast v0.2.0)

Copy Markdown View Source

One connected snapclient. Owns the TCP socket, speaks the snapcast protocol, and writes the audio chunks the stream hands it.

On Hello it replies with ServerSettings + CodecHeader and registers with Snapcast.Server (so the current stream starts feeding it). It answers Time requests for clock sync and tracks the client's volume/mute from ClientInfo.

Summary

Functions

Start reading from the socket (after the acceptor transfers ownership).

Returns a specification to start this module under a supervisor.

Hand a framed message to this session to write to its socket.

Send a new PCM CodecHeader for the next stream format.

Set this client's playback volume (0-100) via a fresh ServerSettings.

Functions

activate(pid)

Start reading from the socket (after the acceptor transfers ownership).

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

send_frame(pid, frame)

Hand a framed message to this session to write to its socket.

set_format(pid, format)

Send a new PCM CodecHeader for the next stream format.

set_volume(pid, volume)

Set this client's playback volume (0-100) via a fresh ServerSettings.

start_link(opts)