Skip to content

Instantly share code, notes, and snippets.

@zamith
Last active August 18, 2016 14:06

Revisions

  1. zamith revised this gist Aug 10, 2015. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    [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
  2. zamith created this gist Aug 10, 2015.
    3 changes: 3 additions & 0 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    helpButton.on("click", event => {
    chan.push("help_needed", {})
    })
    4 changes: 4 additions & 0 deletions help_channel.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    def handle_in("help_needed", payload, socket) do
    broadcast! socket, "help_needed", payload
    {:no_reply, socket}
    end
    3 changes: 3 additions & 0 deletions router.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    socket "/ws" do
    channel "help", HelpPlease.HelpChannel
    end