Reputation: 3452
Im trying to connect a Javascript client to a Elixir phoenix socket by using socket.io. Right now what Im doing is this:
var socket = io.connect('ws/ip.adress.of.server/ws');
However Im not getting a connected true socket object:
Can anyone guide me on the correct way to connect to the phoenix socket? Is there any place in my server code where I can look for the URL I need to connect to?
Thanks
Upvotes: 4
Views: 2351
Reputation: 96
socket.io is a dedicated protocol which works on top of websockets or long polling. It leverages similar concepts to those offered by phoenix sockets. But apart from that, those two are two distinct things which are not interoperable. As Justin Wood mentioned, use phoenix.js when you want to use phoenix channels.
Upvotes: 0