Hi guys!
I’m trying to upgrade the current library for phoenix socket client for elixir itself https://github.com/Aircloak/phoenix_gen_socket_client, which is more than a year old and works for 1.3, but has several outdated things, like Poison dependency, cowboy, among others, and i can’t fix the tests.
It creates a generic base phoenix app, but fails to launch the endpoint:
** (EXIT from #PID<0.265.0>) shutdown: failed to start child: Phoenix.PubSub.PG2
** (EXIT) shutdown: failed to start child: Phoenix.PubSub.LocalSupervisor
** (EXIT) an exception was raised:
** (ArgumentError) argument error
(stdlib) :ets.new(TestSite.Endpoint, [:set, :named_table, {:read_concurrency, true}])
(phoenix_pubsub) lib/phoenix/pubsub/local_supervisor.ex:24: Phoenix.PubSub.LocalSupervisor.init/1
(stdlib) supervisor.erl:295: :supervisor.init/1
(stdlib) gen_server.erl:374: :gen_server.init_it/2
(stdlib) gen_server.erl:342: :gen_server.init_it/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
The weird thing is that i run on iex :ets.new(TestSite.Endpoint, [:set, :named_table, {:read_concurrency, true}])
and runs ok
this is the declaration of the testSite:
defmodule TestSite do
@moduledoc false
defmodule PubSub do
@moduledoc false
def start_link(), do: Registry.start_link(keys: :duplicate, name: TestSite.PubSub)
def subscribe(subscriber_key), do: Registry.register(__MODULE__, subscriber_key, nil)
def notify(subscriber_key, message) do
__MODULE__
|> Registry.lookup(subscriber_key)
|> Enum.map(fn {pid, _value} -> pid end)
|> Enum.each(&send(&1, message))
end
end
defmodule Endpoint do
@moduledoc false
use Phoenix.Endpoint, otp_app: :phoenix_gen_socket_client
socket("/test_socket", TestSite.Socket, websocket: true, longpoll: false)
socket("/test_socket_updated", TestSite.SocketUpdated, websocket: true, longpoll: false)
@doc false
def init(:supervisor, config) do
{:ok,
Keyword.merge(
config,
https: false,
http: [port: 29_876],
secret_key_base: String.duplicate("abcdefgh", 8),
debug_errors: false,
server: true,
pubsub: [adapter: Phoenix.PubSub.PG2, name: __MODULE__]
)}
end
end
...
any clues?