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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]