当另一个客户端连接到服务器时,Mqtt客户端断开连接 [英] Mqtt client disconnects when another client connects to the server

查看:841
本文介绍了当另一个客户端连接到服务器时,Mqtt客户端断开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MQTT消息传递系统的新手,但是我设法在运行AOSP kk-4.4.2的snapdragon板上实现了paho Android服务.我的服务将在启动时启动,并将通过端口1883连接到HiveMQ的公共代理.

I am new to MQTT messaging system, but yet i managed to implement the paho Android service in snapdragon board running AOSP kk-4.4.2 . My service will start at the boot up and it will connect to the public broker of HiveMQ with port 1883 .

问题是将运行自定义AOSP的Android设备连接到服务器后,并且如果我尝试从手机上运行的android应用程序连接另一个客户端.金鱼草板上的客户端会自动与服务器断开连接.当我尝试重新连接时,它再次连接到服务器.

The problem is after connecting my Android device running my custom AOSP to the server and if i try to connect another client from the android application which is running on a phone. The client in the snapdragon board automatically disconnects from the server. when i try to reconnect it is connecting to the server again.

在连接到服务器时,我使用不同的客户端ID和用户名

I use different client Id and user names while connecting to the server

推荐答案

这很可能是因为您为两个(所有)客户端使用了相同的客户端ID.

This is most likely because you are using the same client id for both (all) clients.

客户端ID必须唯一,并且当第二个代理使用相同的ID连接时,大多数代理将断开第一个连接.

Client ids need to be unique and most brokers will disconnect the first connection when a second connects with the same id.

这篇关于当另一个客户端连接到服务器时,Mqtt客户端断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆