PubSub mixin

This is the main class for you.

It comes with following guarantee:

  • Each message that gets sent to it gets received in onReceive exactly once for each observer.

Use it as a ViewModel and Controller at the same time. Make your class extend ThrottledChangeNotifier for enhanced performance and a standard pattern.

SECURITY: When you supervise this PubSub with the SocialCloud, give it a key to make sure all traffic is encrypted. If you also need encrypted metadata, you can use the HashedMetadata Mixin. With LoggedInUser.getKeyFor(LocalityUser) you can obtained a shared secret with another user based on ECDH.

PERFORMANCE: 175 ms for 40.000 events raw (test mode) with constant scale. In Production Mode, add 42ms - 75ms total to that (ping to server and back), so you land at roughly 250 ms for 40.000 events with a simple payload, that is roughly 160.000 events / second. Test was done with the GlobalClickCounter example.

LIMITATIONS: Each event can only contain up to 64 KB of data.

Mixin applications

Properties

ephemeral bool
Do not mess with this
getter/setter pair
fetchStrategy FetchStrategy
Do not mess with this
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeline Timeline
getter/setter pair
waitingMessages Map<int, WaitingMessage>
getter/setter pair

Methods

getLocalizedTopic() String
Return the global topic of the PubSub. All observers of the same topic will receive the same events.
getTopic() String
getWaitingMessages() List<WaitingMessage>
isNimbus() bool
isTopicSharedAcrossApps() bool
Overwrite this, if you want to share this topic across many apps. Otherwise, the topic will be visible only in the context of the app.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onReceive(LocalityEvent localityEvent) → void
React to events being thrown. Use switch case on the localityEvent.event
send(String event, Map<String, dynamic> payload) WaitingMessage
Send an event with a payload to this PubSub. PubSub ensures each event will be received in onReceive exactly once. This will return a waiting message that gets resolved as soon as it has been received on the server. Use .addListener to wait for messages to resolve.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited