nuclearace / Socket.IO-Client-Swift

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

Fallback to XHR polling? #13

Closed naartjie closed 9 years ago

naartjie commented 9 years ago

I'm not even sure if this is necessary on native mobile platforms, but is it not possible that the phone is connected to a wi-fi network which only allows HTTP traffic, and blocks WS connections? In such cases it would be nice to fallback to XHR / long polling, right?

I see these projects both have done something along those lines: https://github.com/francoisp/socket.IO-objc https://github.com/shuoli84/SocketIOCocoa

This project definitely has the nicest API out of all that I have seen, so I wanted to try it first and see how I go with it. I especially like the ACK's on the 1.2 branch: #10

@nuclearace please feel free to comment and say if you don't think this is needed / would help much with getting better connectivity to the server under certain conditions.

And thanks for starting a cool project.

nuclearace commented 9 years ago

I'd have to research it a bit, but I think it would require quite a bit of work. I know that I'd have to change parsing and sending messages, since I built it around SocketRocket/WebSockets.

naartjie commented 9 years ago

Okay, thanks, so you do think it's worth it, but it's not an easy/straightforward fix.

What can I do to help?

nuclearace commented 9 years ago

I think it would be worth it in the long-run. I just have to figure out what needs to change/added to support fallback.

nuclearace commented 9 years ago

@naartjie check out the polling branch. Still needs a bit more testing.

naartjie commented 9 years ago

@nuclearace Oh wow, cool, I will check it out, and let you know. Thanks!!

nuclearace commented 9 years ago

It'll also fix a few bugs I found. i.e binary data is actually broken.

nuclearace commented 9 years ago

Merged.