Zenohex.Examples.LivelinessSubscriber (Zenohex v0.9.1-beta.1)

Copy Markdown View Source

Example GenServer implementation of LivelinessSubscriber using Zenohex.Liveliness.declare_subscriber/3.

This example demonstrates how to subscribe to and react to liveliness updates.

For the actual implementation, please refer to the following,

Examples

iex> Zenohex.Examples.LivelinessSubscriber.start_link([])

Summary

Functions

Starts Elixir.Zenohex.Examples.LivelinessSubscriber.

Stops Elixir.Zenohex.Examples.LivelinessSubscriber

Functions

start_link(args)

@spec start_link(
  session_id: Zenohex.Session.id(),
  key_expr: String.t(),
  name: GenServer.name(),
  callback: (Zenohex.Sample.t() -> term())
) :: GenServer.on_start()

Starts Elixir.Zenohex.Examples.LivelinessSubscriber.

Parameters

  • args – a keyword list that can include the following keys:
    • :session_id – the ID of the session
    • :key_expr – the key expression to subscribe to
    • :callback – the function to call when a liveliness update occurs

stop(name \\ __MODULE__)

@spec stop(GenServer.server()) :: :ok | {:error, reason :: term()}

Stops Elixir.Zenohex.Examples.LivelinessSubscriber