pubnub / dart

PubNub Dart SDK
Other
27 stars 15 forks source link

User Events is not found in Dart PubNub Package #42

Closed subodh-commits closed 3 years ago

subodh-commits commented 3 years ago

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 3 years ago

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.

subodh-commits commented 3 years ago

Okk Thank you sir..it works for me.