clemensm
Broadcast using LongPoll is failing
Hi there
I’m currently developing a small webapp using Phoenix to send mails to a bunch of contacts. In there I wanted to use a channel to update the send status (i.e. how many mails have already been sent etc). However when I gave this a try using only long polling, I get this error message every time I try to do a broadcast:
[error] GenServer #PID<0.660.0> terminating
** (FunctionClauseError) no function clause matching in Phoenix.Transports.LongPoll.Server.handle_info/2
(phoenix) lib/phoenix/transports/long_poll_server.ex:75: Phoenix.Transports.LongPoll.Server.handle_info(%Phoenix.Socket.Broadcast{event: "progress", payload: %{all: 5, done: 1, pending: 4, progress: 20.0}, topic: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}, %{buffer: [], channels: %{"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d" => #PID<0.666.0>}, channels_inverse: %{#PID<0.666.0> => {"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", "1"}}, client_ref: {#PID<0.622.0>, #Reference<0.3659197968.2859466756.205729>}, last_client_poll: 1527437359083, priv_topic: "phx:lp:oRFiAZoBxO6vqxRk/SFVjA==1527437358904", pubsub_server: Daten.PubSub, serializer: Phoenix.Transports.V2.LongPollSerializer, socket: %Phoenix.Socket{assigns: %{current_user: %Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "user">, account: %Accounts.Account{__meta__: #Ecto.Schema.Metadata<:loaded, "account">, id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.451558Z>, updated_at: #DateTime<2018-05-25 10:42:28.451570Z>}, email: "c@m", id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.456345Z>, name: "clemens", updated_at: #DateTime<2018-05-25 10:42:28.456352Z>, user_password: %Accounts.UserPassword{__meta__: #Ecto.Schema.Metadata<:loaded, "user_password">, id: 2, inserted_at: #DateTime<2018-05-25 10:42:28.457810Z>, password: nil, password_hash: "$argon2i$v=19$m=65536,t=6,p=1$UG2SFHp/2G7mhq+lGXVmgw$AOjJEKsj14GCfjhOWS/pmXCkWqmTWYcSfnV7WGZCbAQ", updated_at: #DateTime<2018-05-25 10:42:28.457817Z>, user: #Ecto.Association.NotLoaded<association :user is not loaded>, user_id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}}}, channel: nil, channel_pid: nil, endpoint: DatenWeb.Endpoint, handler: DatenWeb.UserSocket, id: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", join_ref: nil, joined: false, private: %{}, pubsub_server: Daten.PubSub, ref: nil, serializer: Phoenix.Transports.V2.LongPollSerializer, topic: nil, transport: Phoenix.Transports.LongPoll, transport_name: :longpoll, transport_pid: #PID<0.660.0>, vsn: "2.0.0"}, window_ms: 15000})
(stdlib) gen_server.erl:616: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:686: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Broadcast{event: "progress", payload: %{all: 5, done: 1, pending: 4, progress: 20.0}, topic: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}
State: %{buffer: [], channels: %{"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d" => #PID<0.666.0>}, channels_inverse: %{#PID<0.666.0> => {"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", "1"}}, client_ref: {#PID<0.622.0>, #Reference<0.3659197968.2859466756.205729>}, last_client_poll: 1527437359083, priv_topic: "phx:lp:oRFiAZoBxO6vqxRk/SFVjA==1527437358904", pubsub_server: Daten.PubSub, serializer: Phoenix.Transports.V2.LongPollSerializer, socket: %Phoenix.Socket{assigns: %{current_user: %Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "user">, account: %Accounts.Account{__meta__: #Ecto.Schema.Metadata<:loaded, "account">, id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.451558Z>, updated_at: #DateTime<2018-05-25 10:42:28.451570Z>}, email: "c@m", id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.456345Z>, name: "clemens", updated_at: #DateTime<2018-05-25 10:42:28.456352Z>, user_password: %Accounts.UserPassword{__meta__: #Ecto.Schema.Metadata<:loaded, "user_password">, id: 2, inserted_at: #DateTime<2018-05-25 10:42:28.457810Z>, password: nil, password_hash: "$argon2i$v=19$m=65536,t=6,p=1$UG2SFHp/2G7mhq+lGXVmgw$AOjJEKsj14GCfjhOWS/pmXCkWqmTWYcSfnV7WGZCbAQ", updated_at: #DateTime<2018-05-25 10:42:28.457817Z>, user: #Ecto.Association.NotLoaded<association :user is not loaded>, user_id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}}}, channel: nil, channel_pid: nil, endpoint: DatenWeb.Endpoint, handler: DatenWeb.UserSocket, id: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", join_ref: nil, joined: false, private: %{}, pubsub_server: Daten.PubSub, ref: nil, serializer: Phoenix.Transports.V2.LongPollSerializer, topic: nil, transport: Phoenix.Transports.LongPoll, transport_name: :longpoll, transport_pid: #PID<0.660.0>, vsn: "2.0.0"}, window_ms: 15000}
Note that sending the message using a websocket works perfectly, this is just happening when trying to do a long poll. Is this a legitimate bug, or am I missing something regarding how longpolling is implemented?
Thanks a lot
First Post!
OvermindDL1
This seems like a bug, the long poller is not handling the broadcast message, I’d say report it as an issue on github.
Popular in Questions
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
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
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’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Hi!
Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Other popular topics
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
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode.
The solution seems to be, in a hyphena...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
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








