rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
241 stars 84 forks source link

IPv4 preference can cause handshake timeouts on cellular networks #138

Closed benvigier closed 6 years ago

benvigier commented 6 years ago

I have tested RMQClient over T-Mobile LTE on multiple iPhone 6S and earlier models and consistently get a handshake timeout when on LTE (while it works perfectly well over Wifi), when running the demo code in the documentation. After researching the issue extensively, it seems to be caused by some 4G networks IPv4 vs. IPv6 configurations.

Inserting the following line in RMQTCPSocketTransport.initWithHost() fixes the issue:

self.socket.IPv4PreferredOverIPv6 = NO;

Happy to provide more info and video illustrating the issue if needed.

michaelklishin commented 6 years ago

@benvigier thank you for doing all the hard work. Please submit a PR that makes this configurable for starters. I don't have much data or iOS development experience to make an informed decision about what should be the default but open to changing the default as well. Thank you.

michaelklishin commented 6 years ago

A very quick research reveals that some have been recommending preferring IPv6 for a couple of years now and it was never a problem in their app review process. So perhaps changing the default is a good idea.

michaelklishin commented 6 years ago

I hardcoded the setting for now and working on adding a socket configurator interface, much like what Ruby, Java and some other clients have. Then if someone wants to configure a connection's socket, they can do just about anything GDAsyncSocket API allows for.

benvigier commented 6 years ago

Great way to fix it. Thanks Michael.

PS: Sorry for not submitting a PR, I don’t have the project properly set-up in GitHub to do so.

On May 3, 2018, at 11:32 AM, Michael Klishin notifications@github.com wrote:

I hardcoded the setting for now and working on adding a socket configurator interface, much like what Ruby, Java and some other clients have. Then if someone wants to configure a connection's socket, they can do just about anything GDAsyncSocket API allows for.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rabbitmq/rabbitmq-objc-client/issues/138#issuecomment-386393749, or mute the thread https://github.com/notifications/unsubscribe-auth/AXZUS5CUJNNGZS4plYLbad6c8B8kn_U3ks5tu001gaJpZM4TwXw1.