Notification
Notification is a special type of message that can be marked as read and queried. Currently, there are the following types of notifications:
NotificationType.subscription
:Subscription messageNotificationType.receivedFriendRequest
:Received friend requestNotificationType.sendFriendRequest
:Sent friend requestNotificationType.groupInvitation
:Group invitation messageNotificationType.provider
:Provider information
Subscribe
Subscribe a topic with topicId
, then you can receive notifications from that topic
.
client.subscribeTopic(topicId);
Receive
You can use the following method to subscribe notifications from the web3mq server.
client.notificationStream.listen( (notifications) {
// handle the notifications.
});
Read Status
You may need other side to know if you have read the notification.
client.markNotificationsRead(notificationsIds);
Query
You can query all historical notifications by types and pagination.
Page<Notification> res = await client.queryNotifications(type, pagination);