24 lines
590 B
Elixir
24 lines
590 B
Elixir
defmodule ChronoscopeWeb.IndexLive do
|
|
use ChronoscopeWeb, :live_view
|
|
|
|
alias Chronoscope.NTS
|
|
alias Chronoscope.NTS.KeyEstablishmentResponse
|
|
|
|
@topic Application.compile_env(:chronoscope, :nts_topic)
|
|
|
|
def mount(_params, _session, socket) do
|
|
ChronoscopeWeb.Endpoint.subscribe(@topic)
|
|
{:ok, assign(socket, %{servers: server_list()})}
|
|
end
|
|
|
|
def handle_info(%{topic: @topic}, socket) do
|
|
{:noreply, assign(socket, %{servers: server_list()})}
|
|
end
|
|
|
|
defp server_list() do
|
|
Chronoscope.Monitor
|
|
|> GenServer.call(:get_nts_servers)
|
|
|> NTS.list_clients()
|
|
end
|
|
end
|