本文介绍了iOS:无法从Swift建立RabbitMQ连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从Swift连接RabbitMQ.我遵循了此库.创建吊舱设置并输入工作区.检查并验证.成功运行.
I am trying to connect RabbitMQ from Swift. I have followed this library. Created pod setup and entered into workspace. Checked and verified. Successfully running.
viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
connRabbMQ = RMQConnection(uri: "amqp://test:test@192.***.**.17:15672", delegate: RMQConnectionDelegateLogger())
connRabbMQ.start()
}
输出日志:
2016-07-08 10:47:47.943 Demo_Rabb[784:38644] Received connection:
<RMQConnection: 0x7fe458c3a420> failedToConnectWithError: Error
Domain=com.rabbitmq.rabbitmq-objc-client Code=1 "Handshake timed out."
UserInfo={NSLocalizedDescription=Handshake timed out.
}
我不知道发生了什么.请指导我如何与后端连接.
I dont know what is happening. Kindly guide me how to connect with backend.
推荐答案
我遇到了同样的问题,发现我使用了错误的端口号,端口15672用于Web访问,必须将端口5672用于swift客户端或其他客户端应用程序直接访问rabbtiMQ服务器
I had same problem ,I found out I've used incorrect port number, Port 15672 is for web access,you must use Port 5672 for swift client or another client application to access direct to rabbtiMQ server
这篇关于iOS:无法从Swift建立RabbitMQ连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!