Pablo Estrada
Pablo Estrada

Reputation: 3452

Using socket.io to Connect with Elixir's Phoenix Sockets

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:

enter image description here

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

Answers (1)

namxam
namxam

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

Related Questions