mirror of
https://github.com/Retropex/bitfeed.git
synced 2025-05-28 04:52:29 +02:00
37 lines
817 B
Elixir
37 lines
817 B
Elixir
defmodule BitcoinStream.Server do
|
|
use Application
|
|
|
|
def start(_type, _args) do
|
|
children = [
|
|
{ BitcoinStream.Mempool, [port: 9959, name: :mempool] },
|
|
Plug.Cowboy.child_spec(
|
|
scheme: :http,
|
|
plug: BitcoinStream.Router,
|
|
options: [
|
|
dispatch: dispatch(),
|
|
port: 4000
|
|
]
|
|
),
|
|
Registry.child_spec(
|
|
keys: :duplicate,
|
|
name: Registry.BitcoinStream
|
|
),
|
|
BitcoinStream.Bridge.child_spec(port: 29000)
|
|
]
|
|
|
|
opts = [strategy: :one_for_one, name: BitcoinStream.Application]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
defp dispatch do
|
|
[
|
|
{:_,
|
|
[
|
|
{"/ws/txs", BitcoinStream.SocketHandler, []},
|
|
{:_, Plug.Cowboy.Handler, {BitcoinStream.Router, []}}
|
|
]
|
|
}
|
|
]
|
|
end
|
|
end
|