Skip to content

Instantly share code, notes, and snippets.

@zamith
Last active August 18, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamith/4d239a5690a68d13c4af to your computer and use it in GitHub Desktop.
Save zamith/4d239a5690a68d13c4af to your computer and use it in GitHub Desktop.
helpButton.on("click", event => {
chan.push("help_needed", {})
})
[error] GenServer #PID<0.299.0> terminating
Last message: %Phoenix.Socket.Message{event: "help_needed", payload: %{}, ref: "2", topic: "help"}
State: %Phoenix.Socket{assigns: %{}, channel: HelpPlease.HelpChannel, channel_pid: #PID<0.299.0>, endpoint: HelpPlease.Endpoint, joined: true, pubsub_server: HelpPlease.PubSub, ref: nil, topic: "help", transport: Phoenix.Transports.WebSocket, transport_pid: #PID<0.297.0>}
** (exit) an exception was raised:
** (RuntimeError) Expected `handle_in/3` to return one of:
{:noreply, Socket.t} |
{:reply, {status :: atom, response :: map}, Socket.t} |
{:reply, status :: atom, Socket.t} |
{:stop, reason :: term, Socket.t} |
{:stop, reason :: term, {status :: atom, response :: map}, Socket.t} |
{:stop, reason :: term, status :: atom, Socket.t}
got {:no_reply, %Phoenix.Socket{assigns: %{}, channel: HelpPlease.HelpChannel, channel_pid: #PID<0.299.0>, endpoint: HelpPlease.Endpoint, joined: true, pubsub_server: HelpPlease.PubSub, ref: "2", topic: "help", transport: Phoenix.Transports.WebSocket, transport_pid: #PID<0.297.0>}}
(phoenix) lib/phoenix/channel/server.ex:255: Phoenix.Channel.Server.handle_result/2
(stdlib) gen_server.erl:593: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:659: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:237: :proc_lib.init_p_do_apply/3
def handle_in("help_needed", payload, socket) do
broadcast! socket, "help_needed", payload
{:no_reply, socket}
end
socket "/ws" do
channel "help", HelpPlease.HelpChannel
end
@smeevil
Copy link

smeevil commented Aug 18, 2016

Old post, but someone in the irc channel found it and was hoping for a solution, so just putting an answer here :)
the correct response for help_channel.ex:3 is: {:noreply, socket} notice the missing underscore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment