Does anyone know if it is possible to use Phoenix Channels and Cowboy WebSockets on the same application?
It looks like that adding http: [dispatch: [...]
to my config/config.exs
breaks phoenix channels.
After that change now I always get (Phoenix.Router.NoRouteError) no route found for GET /socket/websocket
.
My dispatch code is the following:
http: [dispatch: [
{:_, [
{"/mysock", MyWebsocketApp.SocketHandler, []},
{:_, Plug.Cowboy.Handler, {Astarte.DeviceForwarderWeb.Endpoint, []}}
]}
]]
lib/astarte_device_forwarder_web/endpoint.ex
:
socket "/socket", Astarte.DeviceForwarderWeb.UserSocket,
websocket: [connect_info: [:peer_data, :x_headers]],
longpoll: false