rabbitmq / rabbitmq-objc-client

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

Handshake timed out #135

Closed difoi closed 6 years ago

difoi commented 6 years ago

// code
let delegate = RMQConnectionDelegateLogger() // implement RMQConnectionDelegate yourself to react to errors let conn = RMQConnection(uri: "amqp://autotest:autotest@121.40.171.xxx:15672/autotest_vhost", delegate: delegate, recoverAfter:3) conn.start { print("连接成功")

        let ch = conn.createChannel()

        let q = ch.queue("myqueue")
        q.subscribe({ m in
            print("Received: \(String(data: m.body, encoding: String.Encoding.utf8))")
        })
        q.publish("foo".data(using: String.Encoding.utf8))
    }
}

// print error Received connection: <RMQConnection: 0x13d920860> failedToConnectWithError: Error Domain=com.rabbitmq.rabbitmq-objc-client Code=1 "Handshake timed out." UserInfo={NSLocalizedDescription=Handshake timed out.}

michaelklishin commented 6 years ago

Thank you for your time.

Team RabbitMQ uses GitHub issues for specific actionable items engineers can work on. GitHub issues are not used for questions, investigations, root cause analysis, discussions of potential issues, etc (as defined by this team).

We get at least a dozen of questions through various venues every single day, often light on details. At that rate GitHub issues can very quickly turn into a something impossible to navigate and make sense of even for our team. Because GitHub is a tool our team uses heavily nearly every day, the signal/noise ratio of issues is something we care about a lot.

Please post this to rabbitmq-users.

Thank you.

michaelklishin commented 6 years ago

You are trying to connect to port 15672, which is used by the HTTP API. You probably want port 5672.

When in doubt, see server logs, all connection lifecycle events are logged. Network Troubleshooting guide is also relevant.