banano
Help upgrading phoenix socket client lib to phoenix 1.4
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?
Most Liked
benwilson512
Author of Craft GraphQL APIs in Elixir with Absinthe
This probably means the endpoint is already started, or that there is at least an :ets table with that name already:
iex(1)> :ets.new(TestSite.Endpoint, [:set, :named_table, {:read_concurrency, true}])
TestSite.Endpoint
iex(2)> :ets.new(TestSite.Endpoint, [:set, :named_table, {:read_concurrency, true}])
** (ArgumentError) argument error
(stdlib) :ets.new(TestSite.Endpoint, [:set, :named_table, {:read_concurrency, true}])
Maybe that helps point you in the right direction?
1
Popular in Questions
Hi All,
I set a environment variables in dev.exs , like below code.
when i start server, how can i set the ${enable} value?
thanks.
d...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
For example for a current url like
http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2,
I would like to get:
...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
Other popular topics
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I’m writing a test for one of the...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Hello guys,
I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition)
It’s been a while since we first asked this, I...
New
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








