You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bifromq.apache.org by "jxlgzwh (via GitHub)" <gi...@apache.org> on 2026/01/02 11:11:57 UTC

[I] mqtt client 状态获取 [bifromq]

jxlgzwh opened a new issue, #212:
URL: https://github.com/apache/bifromq/issues/212

   
   1、当前问题
   当前/session  ,get 请求 的  api 接口是获取单个clent 的状态,如果设备量多,会导致请求次数过多
   
   2、 期望结果
   client 的状态 回调接口或者 topic 的通知接口
   希望实现 client 上线和离线状态可以通过回调接口  告诉 应用程序,或者 应用程序通过订阅某个 topic 来获取
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "jxlgzwh (via GitHub)" <gi...@apache.org>.
jxlgzwh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3681761557

   咨询一下  1、设备在线  EventType  = CLIENT_CONNECTED   , 2、对应的设备 离线 是 哪一种 EventType ?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "Gujiawei-Edinburgh (via GitHub)" <gi...@apache.org>.
Gujiawei-Edinburgh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3708091498

   > MQTTClientInfoConstants 没有看到sessionId ,需要如何获取 sessionId?
   
   The `sessionId` mapping in `MQTTClientInfoConstants` depends on your session flag:
   
   `Clean Session (true)`: userId / channelId
   
   `Persistent Session (false)`: userId / clientId
   
   Also, `channelId` is the only identifier for the connection itself


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] how to get mqtt client status [bifromq]

Posted by "Gujiawei-Edinburgh (via GitHub)" <gi...@apache.org>.
Gujiawei-Edinburgh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3760627687

   > 希望应用端可以获取到 设备的 在线 和离线状态 1、场景:应用程序有可能需要停止服务,导致 没有收到 event 事件,会导致 设备状态 错误 2、想法:希望可以获取到 设备端发送的 心跳包,和心跳发生时间间隔,辅助判断设备在线状态,比如 设备端 每 60 s 发生一次心态包 ,如果接收到心态包,设备为在线状态 ,如果 超过 规定时间,则为 离线状态。
   
   1. If you want to receive **PING events**, there is a `PingReq` event in the system.
      This event is **only enabled when `debugMode` is set to `true`** (it is `false` by default).
      You can enable it via your custom `SettingProvider`.
   
   2. For **Keep Alive**, the value is available in the `ClientConnected` event as
      `keepAliveTimeSeconds`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "Gujiawei-Edinburgh (via GitHub)" <gi...@apache.org>.
Gujiawei-Edinburgh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3682470895

   > 咨询一下 1、设备在线 EventType = CLIENT_CONNECTED , 2、对应的设备 离线 是 哪一种 EventType ?
   
   Suppose you are using v3.3.5. `ClientConnected` is the event that indicates a client has successfully connected to the BifroMQ system. 
   
   Client disconnection events are represented by subclasses of `ClientDisconnectEvent`. If a client proactively sends a `DISCONNECT` message, the corresponding event type is `ByClient`.
   
   In addition, BifroMQ defines different disconnection event types based on the underlying reason (for example, `BadPacket`, `Kicked`, etc.), which can be helpful for diagnosing and debugging connection issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "jxlgzwh (via GitHub)" <gi...@apache.org>.
jxlgzwh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3758522327

   1、场景:应用程序有可能需要停止服务,导致 没有收到  event 事件,会导致 设备状态 错误
   2、想法:希望可以获取到  设备端发送的 心跳包,辅助判断设备在线状态


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "jxlgzwh (via GitHub)" <gi...@apache.org>.
jxlgzwh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3705125700

   1、EventLogger 的 plugin demo 中,可以通过event 类型判断是否离线,希望知道通过 event 如何 判断具体是哪个 clientId 的 离线 ?  event 如何关联到 clentid
   
   2、对于同一个 ClientId ,如果 ClientId 登录了两次,希望可以查询到 clientId  的 两个 sessionId ,这样可以识别那一次是最新的登录,用来终止前一次会话的业务操作 , 保留最新会话的任务 。
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "jxlgzwh (via GitHub)" <gi...@apache.org>.
jxlgzwh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3707997577

   MQTTClientInfoConstants 没有看到sessionId ,需要如何获取  sessionId?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "Gujiawei-Edinburgh (via GitHub)" <gi...@apache.org>.
Gujiawei-Edinburgh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3678839898

   BifroMQ reports events through `IEventCollector` plugin sytsem. For example, the `ClientConnected` event represents a client connection event. You can customize an event collector plugin to handle these events in your own way—for instance, by publishing a special topic to notify listener clients.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "Gujiawei-Edinburgh (via GitHub)" <gi...@apache.org>.
Gujiawei-Edinburgh commented on issue #212:
URL: https://github.com/apache/bifromq/issues/212#issuecomment-3706894242

   > 1、EventLogger 的 plugin demo 中,可以通过event 类型判断是否离线,希望知道通过 event 如何 判断具体是哪个 clientId 的 离线 ? event 如何关联到 clentid
   > 
   > 2、对于同一个 ClientId ,如果 ClientId 登录了两次,希望可以查询到 clientId 的 两个 sessionId ,这样可以识别那一次是最新的登录,用来终止前一次会话的业务操作 , 保留最新会话的任务 。
   
   1.  If you are using the ByClient disconnection event, you can retrieve event metadata via code like:
   `byClient.clientInfo().getMetadataMap().get("clientId");`. The related metadata keys are defined in `com.baidu.bifromq.type.MQTTClientInfoConstants`.
   2. You can also use `broker` in event metadata to get the corresponding sessionId. Since the MQTT protocol does not allow the same `clientId` to be connected to a broker simultaneously. You can correlate connection and disconnection events to help with diagnosis and troubleshooting. For example, if one client disconnected to BifroMQ and connected to BifroMQ again, you will see disconnection event and `ClientConnected` event. If the previous connection was kicked by the second connection, you will see the `Kicked` disconnection event. And each event has clientInfo field.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] mqtt client 状态获取 [bifromq]

Posted by "jxlgzwh (via GitHub)" <gi...@apache.org>.
jxlgzwh closed issue #212: mqtt client  状态获取
URL: https://github.com/apache/bifromq/issues/212


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@bifromq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org