Packages
MTProto (Telegram) implementation for Elixir.
Retired package: Deprecated - This package is not maintained anymore.
Current section
Files
Jump to
Current section
Files
lib/mtproto/supervisor.ex
defmodule MTProto.Supervisor do
use Supervisor
# Main supervisor. Start the session's registry, the dc's registry and both
# the listener and handler supervisors.
@moduledoc false
@name MTProto.Supervisor
def start_link do
Supervisor.start_link(__MODULE__, :ok, name: @name)
end
def init(_) do
children = [
worker(MTProto.Registry, [DCRegistry], [restart: :permanent, id: DCRegistry]),
worker(MTProto.Registry, [SessionRegistry], [restart: :permanent, id: SessionRegistry]),
supervisor(MTProto.Session.HandlerSupervisor, [], [restart: :permanent]),
supervisor(MTProto.Session.ListenerSupervisor, [], [restart: :permanent]),
supervisor(MTProto.Session.History, [], [restart: :permanent]),
]
supervise(children, strategy: :one_for_one)
end
def stop do
Supervisor.stop(@name)
end
end