Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Zenohex subscriber

zenohex_subscriber.livemd

Zenohex subscriber

Mix.install([
  {:zenohex, "~> 0.3"},
  {:kino, "~> 0.14"}
])

Subscribe

{:ok, session} = Zenohex.open()
{:ok, subscriber} =
  Zenohex.Session.declare_subscriber(session, "key/expression")
frame = Kino.Frame.new()
case Zenohex.Subscriber.recv_timeout(subscriber, 10_000_000) do
  {:error, :timeout} ->
    nil
  {:ok, msg} ->
    Kino.Frame.append(frame, Kino.Markdown.new(msg.value))
end