Skip to content

Instantly share code, notes, and snippets.

@rossjones
Last active August 29, 2015 14:15
Show Gist options
  • Save rossjones/a6b921b5c374b424bf1e to your computer and use it in GitHub Desktop.
Save rossjones/a6b921b5c374b424bf1e to your computer and use it in GitHub Desktop.
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in Phoenix.Transports.WebSocket.ws_info/2
(phoenix) lib/phoenix/transports/websocket.ex:67: Phoenix.Transports.WebSocket.ws_info(%{"behaviour" => "behaviours/global/my.behaviour", "post" => %{"demographics" => [%{"hospital_number" => "54321", "nhs_number" => "1234"}], "diagnosis" => %{"condition" => "CAP"}}, "pre" => %{"demographics" => [%{"hospital_number" => "54321", "nhs_number" => "1234"}], "diagnosis" => %{"condition" => "CAP"}}, "success" => true}, %{router: Cedar.Router, serializer: Phoenix.Transports.JSONSerializer, sockets: #HashDict<[{"audit:all", %Phoenix.Socket{assigns: %{}, authorized: true, channel: Cedar.AuditChannel, pid: #PID<0.419.0>, router: Cedar.Router, topic: "audit:all", transport: Phoenix.Transports.WebSocket}}]>})
(phoenix) lib/phoenix/endpoint/cowboy_websocket.ex:62: Phoenix.Endpoint.CowboyWebSocket.websocket_info/3
(cowboy) src/cowboy_websocket.erl:588: :cowboy_websocket.handler_call/7
(phoenix) lib/phoenix/endpoint/cowboy_websocket.ex:11: Phoenix.Endpoint.CowboyWebSocket.resume/4
(phoenix) lib/phoenix/endpoint/cowboy_handler.ex:62: Phoenix.Endpoint.CowboyHandler.upgrade/4
(cowboy) src/cowboy_protocol.erl:435: :cowboy_protocol.execute/4
# Called with (following https://github.com/lancehalvorsen/phoenix-guides/blob/master/G_channels.md for docs)
Phoenix.PubSub.broadcast("audit:all", blob)
# Also with Phoenix.PubSub.broadcast("audit:all", {:message, "It Works!"})
# Channel looks like
defmodule Cedar.AuditChannel do
use Phoenix.Channel
def join("audit:all", _message, socket) do
{:ok, socket}
end
def leave(_reason, socket) do
{:ok, socket}
end
end
# Router config is
socket "/ws", Cedar do
channel "audit:*", AuditChannel
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment