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

Copy Markdown View Source

Example GenServer implementation of Subscriber using Zenohex.Session.declare_subscriber/4.

This example demonstrates how to receive samples.

For the actual implementation, please refer to the following,

Examples

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

Summary

Functions

Starts Elixir.Zenohex.Examples.Subscriber.

Stops Elixir.Zenohex.Examples.Subscriber

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.Subscriber.

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 sample is received

stop(name \\ __MODULE__)

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

Stops Elixir.Zenohex.Examples.Subscriber