Article From:https://segmentfault.com/q/1010000011699136
Question:

emqttdThere are two ways in existence:
1.Through HTTP API (/api/clients), you can get all users who are currently online.
2.Subscribe to system themes
$SYS/brokers/${node}/clients/${clientid}/connected
$SYS/brokers/${node}/clients/${clientid}/disconnected
Receive incoming and offline notification separately.

The first way I think about it is to get all the online users at regular intervals through a timed task, and then compare the updates to redis
The second way is normal receipt notification update.

But now there are two problems.
The first method is not really real-time acquisition of data, will produce delays, and the large amount of data processing process time is not short;
Although the second method looks very flexible, but because the refresh of the web side will trigger the user’s offline and offline, so the server receives messages very high frequency, and can not rule out false offline;

Is there any expert who knows how to deal with this problem?

Answer 0:

Can I add QQ to my landlord? I’m also using EMQ to do web push to ask you questions.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *