rabbitmq / rabbitmq-objc-client

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

RMQ connection keep connect with cellular when device turn on wifi #167

Closed tanphamanhh closed 5 years ago

tanphamanhh commented 5 years ago

When I debug connection with RMQConnectionDelegate, I figure out when app is connected with cellular network and RMQ is opened, and I turn on wifi (and still keep cellular network on) then RMQ connection keeps connect to server with cellular network. I think it must be re-connect via high-priority network (wifi > cellular). When I turn off cellular, RMQConnectionDelegate fire event and start recovery and from this time, RMQ connection has re-connected via wifi

michaelklishin commented 5 years ago

This is expected. This client does not react to network interface changes and I'd argue that it should not. An example of what it would take to implement this as an option would be welcome (as a pull request). Thank you.

tanphamanhh commented 5 years ago

Yeah, I think it is an option you should be take care of, And an additional question, how can I manually attempt re-connect RMQ. Maybe I close connection and start again?

michaelklishin commented 5 years ago

This is open source software, you are welcome to at least demonstrate the idea. I'm afraid a single claim that something should be done is not very convincing.

Closing the connection and opening a new one should work. RMQConnection#start might also work but we have no tests for that. Again, you are welcome to contribute both tests and code improvements.