You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for broadcast replay configuration (#1242)
* feat: add support for broadcast replay configuration
Added ReplayOption class and replay field to RealtimeChannelConfig
to support configuring broadcast replay with 'since' timestamp and optional
'limit' parameter. Broadcast callbacks will automatically receive meta field
with replayed status and message id when replay is enabled.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* docs: improve docs for broadcast replay
---------
Co-authored-by: Claude <[email protected]>
Copy file name to clipboardExpand all lines: packages/realtime_client/lib/src/types.dart
+36-4Lines changed: 36 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -138,13 +138,39 @@ extension ToType on RealtimeListenTypes {
138
138
}
139
139
}
140
140
141
+
/// Configuration for broadcast replay feature.
142
+
/// Allows replaying broadcast messages from a specific timestamp.
143
+
classReplayOption {
144
+
/// Unix timestamp (in milliseconds) from which to start replaying messages
145
+
finalint since;
146
+
147
+
/// Optional limit on the number of messages to replay, maximum value of 25.
148
+
finalint? limit;
149
+
150
+
constReplayOption({
151
+
requiredthis.since,
152
+
this.limit,
153
+
});
154
+
155
+
Map<String, dynamic> toMap() {
156
+
final map =<String, dynamic>{'since': since};
157
+
if (limit !=null) {
158
+
map['limit'] = limit;
159
+
}
160
+
return map;
161
+
}
162
+
}
163
+
141
164
classRealtimeChannelConfig {
142
165
/// [ack] option instructs server to acknowlege that broadcast message was received
143
166
finalbool ack;
144
167
145
168
/// [self] option enables client to receive message it broadcasted
146
169
finalbool self;
147
170
171
+
/// [replay] enables **private** channels to access messages that were sent earlier. Only messages published via [Broadcast From the Database](https://supabase.com/docs/guides/realtime/broadcast#trigger-broadcast-messages-from-your-database) are available for replay.
172
+
finalReplayOption? replay;
173
+
148
174
/// [key] option is used to track presence payload across clients
149
175
finalString key;
150
176
@@ -157,18 +183,24 @@ class RealtimeChannelConfig {
0 commit comments