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