Closed dmdque closed 7 years ago
Does it work through regular JS websocket?
Yes it does. Joining channels and chatting works fine with https://github.com/chrismccord/phoenix_chat_example. But using the same backend with an iOS client doesn't.
Do you have check_origin: false
in your endpoint config? By default we check origin which makes sense for browsers, but not other clients. Can you confirm it's disabled?
Though I would expect our logs to whine at you about this, but lets start there
Yup, I've got that line.
Does the birdsong client log anything? Is the connection established on the client?
Hold on, I got the Birdsong client to work. Looks like I was missing some code to make it actually join:
let socket = Birdsong.Socket(url: URL(string: "http://10.88.111.2:4000/socket/websocket")!)
socket.onConnect = {
let channel = socket.channel("room:lobby", payload: ["user": "test"])
}
socket.connect()
In an effort to keep things simple I left out onConnect
, thinking that it did nothing important. Too much simplification...
SwiftPhoenixClient still isn't working though, but it's not an issue with this project.
Thanks!
Environment
Elixir version (elixir -v): 1.3.4
Phoenix version (mix deps):
NodeJS version (node -v): v6.7.0
NPM version (npm -v): 3.10.7
Operating system: macOS Sierra 10.12.1
Expected behavior
Join room from iOS and see logs on the server to confirm that the room has been joined.
Actual behavior
Join room from iOS, no logs on server.
Description
I'm using a simple Phoenix instance, and have a simple channel join event working as expected with a JS client. I'm using the following on iOS SwiftPhoenixClient:
But nothing is logged on the server. I also tried with Birdsong with the same result:
I'm watching the traffic going through the server's port 4000 (
sudo tcpdump port 4000
) and am seeing some packets flow every time I trigger the above code. eg. (10.88.111.2
is the server's IP, and10.88.111.30
is the iOS client's IP)I've also created a ticket here: https://github.com/davidstump/SwiftPhoenixClient/issues/61. But it seems unlikely that the client is the issue since this happens with two of them.