nuclearace / Socket.IO-Client-Swift

socket.io-client for Swift
Other
361 stars 53 forks source link

using websockets and swift #101

Closed zglozman closed 8 years ago

zglozman commented 8 years ago

When using

    self.socket = SocketIOClient(socketURL: self.endPoint, options: [.Log(false), .Nsp("/TcpServerWS"), ])

I get this from image which is clearly using polling which is not what i want

or if i use ForceWebsockets it just does this and sever does not get connect event, what can i do ? image

nuclearace commented 8 years ago

If you don't force polling the client should automatically upgrade to websockets. What server are you using? I know there was a version of a python based server that didn't properly handle a forced websockets connection.

zglozman commented 8 years ago

node.js with the most standard configuration var debug = require('debug')('http') var app = require('http').createServer(handler) var io = require('socket.io')(app); var fs = require('fs'); var Logger = require('socket.io-logger')();

io.use(Logger); function handler (req, res) { res.end('Error loading index.html'); res.writeHead(200); res.end(data); }

app.listen(8108); var tcpProxyServer = require('../src/TcpProxyServer'); // or pass no server and then you can call the method

io.serveClient(false); io.attach(app);

var proxy = new tcpProxyServer(io, "127.0.0.1"); proxy.init();

nuclearace commented 8 years ago

My guess it's something to do with that proxy server. Have you tried the JS client from a browser?

zglozman commented 8 years ago

will try no, but my guess it will work, its something on ios side, maybe no websocket w/o ssl ?

nuclearace commented 8 years ago

For your pics it doesn't look like it's trying to use HTTPS.

zglozman commented 8 years ago

i understand but maybe i should ?

nuclearace commented 8 years ago

iOS 9 is a lot stricter about connections and TLS, so maybe.

nuclearace commented 8 years ago

Was this resolved?

zglozman commented 8 years ago

And essentially i dont know what i did. the problem is on the swift side.