Closed Dmurph24 closed 9 years ago
What version of socket.io is the server running?
The server is running on version 1.3.5 for socket.io, the newest version
Would you be able to provide your server url? Because I'm able to connect to my test server fine.
The only thing I've noticed is if you pass http:// or leave out the https:// when the port is actually tls.
Oh, you might need to actually specify the socket.io url.
Including the port.
Wait, nvm. I think I can connect.
So the problem was I needed the extra parameters? Can you explain? I will try this out when I have my laptop handy.
You shouldn't need them, since those are the default, they're just there for testing.
I'm not sure why it's saying Could not connect to the server
. I think that's something coming from the Engine here https://github.com/nuclearace/Socket.IO-Client-Swift/blob/master/SocketIOClientSwift/SocketEngine.swift#L360
But the connection is working for you? Can you provide your code?
I used your parameters and it now is connecting!
I can provide a base case.
import Foundation
let socket = SocketIOClient(socketURL: "spotbox.herokuapp.com", options: ["log": true])
socket.on("connect") {data, ack in
println("socket connected")
}
socket.connect()
CFRunLoopRun()
This assumes you submodule the client, and it's OS X
I really have no idea why its working now, because I had exactly this before but its possible I changed one little thing. Most importantly, its working now! Thanks so much for the help!
No problem.
How to know if timeout error occurs while connecting the server in this example?
I didn't get the correct answer for this.
I am trying to connect a socket to my remote server with the following syntax:
let socket = SocketIOClient(socketURL: "my.server.com:port")
I have tried this with and without the port referenced andhttp://
addedWhen I call
socket.connect()
I receive the following errors:I am 100% certain that the server is handling appropriately. I did notice all the examples given using this library are using
localhost
instead of a remote server connection. Something else to note is that the server is hosted by heroku. However, we have an equivalent app that is for android which connects to it just fine.Is anyone able to explain why I am having this issue?