DatabaseBroadcastRelay class final

Relays the Pusher server's frames between servers through the database (REVERB_SCALING_ENABLED), as Reverb does through Redis: send stores a frame, and every isolate of every other server reads it (start) and hands it to its own connections.

PostgreSQL wakes the readers with NOTIFY; other databases are read every poll. A reader looks back 64 ids, so a frame committed after a later one (two servers inserting at once) is still delivered, once.

Implemented types

Constructors

DatabaseBroadcastRelay(DatabaseManager db, {required DatabaseChannelState state, String? connection, Duration poll = const Duration(milliseconds: 100), void onError(Object error)?})
Relays messages between servers through db, polling every poll.

Properties

connection → String?
The connection of the tables; the default one when null.
final
db → DatabaseManager
The database relaying the messages.
final
hashCode → int
The hash code for this object.
no setterinherited
onError → void Function(Object error)?
Called when relaying fails.
final
poll → Duration
How often new messages are read.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
server → String
This server's id.
no setter
state → DatabaseChannelState
Sends the heartbeat and prunes as the relay runs.
final

Methods

close() → Future<void>
Stops reading.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(String channel, String envelope) → Future<void>
Stores envelope (<except socket>\n<frame>) for the other servers.
override
start(void deliver(String channel, String envelope)) → Future<void>
Starts reading the other servers' frames into deliver until close.
override
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

notification → const String
The notification that wakes the readers.