17 lines
378 B
Elixir
17 lines
378 B
Elixir
defmodule ChronoscopeWeb.IndexLive do
|
|
use ChronoscopeWeb, :live_view
|
|
|
|
alias Chronoscope.NTS
|
|
|
|
@topic "nts-servers"
|
|
|
|
def mount(_params, _session, socket) do
|
|
ChronoscopeWeb.Endpoint.subscribe(@topic)
|
|
{:ok, assign(socket, %{servers: NTS.list()})}
|
|
end
|
|
|
|
def handle_info(%{topic: @topic}, socket) do
|
|
{:noreply, assign(socket, %{servers: NTS.list()})}
|
|
end
|
|
end
|