Skip to content

Commit

Permalink
feat: Added onSystemEvents listener
Browse files Browse the repository at this point in the history
  • Loading branch information
dshukertjr committed Sep 4, 2024
1 parent ec5d47e commit c021c52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/realtime_client/lib/src/realtime_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ class RealtimeChannel {
);
}

/// Sets up a listener for realtime system events for debugging purposes.
RealtimeChannel onSystemEvents(
void Function(Map<String, dynamic> payload) callback,
) {
return onEvents(
'system',
ChannelFilter(),
(payload, [ref]) => callback(Map<String, dynamic>.from(payload)),
);
}

@internal
RealtimeChannel onEvents(
String type, ChannelFilter filter, BindingCallback callback) {
Expand Down
2 changes: 1 addition & 1 deletion packages/realtime_client/lib/src/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ enum ChannelResponse {
error
}

enum RealtimeListenTypes { postgresChanges, broadcast, presence }
enum RealtimeListenTypes { postgresChanges, broadcast, presence, system }

enum PresenceEvent { sync, join, leave }

Expand Down

0 comments on commit c021c52

Please sign in to comment.