pub fn start(
config: Config,
) -> (Receiver<Request>, JoinHandle<Result<(), Error>>)Expand description
Start the daemon with the given config.
The Receiver returned by this functions can be used to listen for requests
that are not broadcast to all clients connected via the IPC socket. This is to ensure requests
such as Request::Raise do not cause conflicts when there are multiple clients attempting to
handle them all at once.
The daemon usually starts listening for commands around 100ms after this function is called, but some commands sent too early might fail if the music library isn’t loaded yet, the playback module is not initialized, or if the MPRIS server isn’t running (if the MPRIS feature is enabled).
The initialization of the music library is by far the most time-consuming process during startup, and the time it takes vastly depends on the read speeds of the hard drive on the host machine and the size of the music library.
Note: This function launches the daemon in a separate thread, it doesn’t block.
§Examples
let config = chilen_daemon::Config::try_default().unwrap();
let (_, handle) = chilen_daemon::start(config);
match handle.join().unwrap() {
Ok(_) => println!("Daemon exited"),
Err(e) => {
panic!("Daemon failed: {e}");
}
}