Skip to content

Commit a12b097

Browse files
authored
feat: Added onSystemEvents listener (#1025)
* feat: Added onSystemEvents listener * change the type of payload * change the type of parameter for onSystemEvents
1 parent ec5d47e commit a12b097

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/realtime_client/lib/src/realtime_channel.dart

+11
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,17 @@ class RealtimeChannel {
410410
);
411411
}
412412

413+
/// Sets up a listener for realtime system events for debugging purposes.
414+
RealtimeChannel onSystemEvents(
415+
void Function(dynamic payload) callback,
416+
) {
417+
return onEvents(
418+
'system',
419+
ChannelFilter(),
420+
(payload, [ref]) => callback(payload),
421+
);
422+
}
423+
413424
@internal
414425
RealtimeChannel onEvents(
415426
String type, ChannelFilter filter, BindingCallback callback) {

packages/realtime_client/lib/src/types.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ enum ChannelResponse {
110110
error
111111
}
112112

113-
enum RealtimeListenTypes { postgresChanges, broadcast, presence }
113+
enum RealtimeListenTypes { postgresChanges, broadcast, presence, system }
114114

115115
enum PresenceEvent { sync, join, leave }
116116

0 commit comments

Comments
 (0)