pubnub/dart

User Events is not found in Dart PubNub Package

subodh-commits opened this issue · 2 comments

User events are triggered when user metadata is set or deleted. Other users can receive these events by subscribing to the user's channel or if they are members of the same channel. In flutter PubNub package presently does not have such event handler who can handle update event.

are commented

Hi!

In Dart SDK all messages that are sent through the PubNub network are received through the Subscription class. There is no separate event handler for each event type. However, each message in the subscription.messages stream has a messageType property that tells you what kind of message it is. In case of Objects events, the messageType will equal to MessageType.objects.

To create a stream with only Objects events, you can do something like this:

var subscription = pubnub.subscribe(channels: {'myChannel'});

var objectEvents = subscription.messages.where((envelope) => envelope.messageType == MessageType.objects);

Let me know if that answers your question.

Okk Thank you sir..it works for me.