@@ -64,6 +64,7 @@ extension Socket {
64
64
}
65
65
66
66
public final class RealtimeChannelV2 : Sendable {
67
+ @available ( * , deprecated, renamed: " RealtimeSubscription " )
67
68
public typealias Subscription = ObservationToken
68
69
69
70
public enum Status : Sendable {
@@ -464,9 +465,9 @@ public final class RealtimeChannelV2: Sendable {
464
465
/// Listen for clients joining / leaving the channel using presences.
465
466
public func onPresenceChange(
466
467
_ callback: @escaping @Sendable ( any PresenceAction ) -> Void
467
- ) -> Subscription {
468
+ ) -> RealtimeSubscription {
468
469
let id = callbackManager. addPresenceCallback ( callback: callback)
469
- return Subscription { [ weak callbackManager, logger] in
470
+ return RealtimeSubscription { [ weak callbackManager, logger] in
470
471
logger? . debug ( " Removing presence callback with id: \( id) " )
471
472
callbackManager? . removeCallback ( id: id)
472
473
}
@@ -479,7 +480,7 @@ public final class RealtimeChannelV2: Sendable {
479
480
table: String ? = nil ,
480
481
filter: String ? = nil ,
481
482
callback: @escaping @Sendable ( AnyAction ) -> Void
482
- ) -> Subscription {
483
+ ) -> RealtimeSubscription {
483
484
_onPostgresChange (
484
485
event: . all,
485
486
schema: schema,
@@ -497,7 +498,7 @@ public final class RealtimeChannelV2: Sendable {
497
498
table: String ? = nil ,
498
499
filter: String ? = nil ,
499
500
callback: @escaping @Sendable ( InsertAction ) -> Void
500
- ) -> Subscription {
501
+ ) -> RealtimeSubscription {
501
502
_onPostgresChange (
502
503
event: . insert,
503
504
schema: schema,
@@ -516,7 +517,7 @@ public final class RealtimeChannelV2: Sendable {
516
517
table: String ? = nil ,
517
518
filter: String ? = nil ,
518
519
callback: @escaping @Sendable ( UpdateAction ) -> Void
519
- ) -> Subscription {
520
+ ) -> RealtimeSubscription {
520
521
_onPostgresChange (
521
522
event: . update,
522
523
schema: schema,
@@ -535,7 +536,7 @@ public final class RealtimeChannelV2: Sendable {
535
536
table: String ? = nil ,
536
537
filter: String ? = nil ,
537
538
callback: @escaping @Sendable ( DeleteAction ) -> Void
538
- ) -> Subscription {
539
+ ) -> RealtimeSubscription {
539
540
_onPostgresChange (
540
541
event: . delete,
541
542
schema: schema,
@@ -553,7 +554,7 @@ public final class RealtimeChannelV2: Sendable {
553
554
table: String ? ,
554
555
filter: String ? ,
555
556
callback: @escaping @Sendable ( AnyAction ) -> Void
556
- ) -> Subscription {
557
+ ) -> RealtimeSubscription {
557
558
precondition (
558
559
status != . subscribed,
559
560
" You cannot call postgresChange after joining the channel "
@@ -571,7 +572,7 @@ public final class RealtimeChannelV2: Sendable {
571
572
}
572
573
573
574
let id = callbackManager. addPostgresCallback ( filter: config, callback: callback)
574
- return Subscription { [ weak callbackManager, logger] in
575
+ return RealtimeSubscription { [ weak callbackManager, logger] in
575
576
logger? . debug ( " Removing postgres callback with id: \( id) " )
576
577
callbackManager? . removeCallback ( id: id)
577
578
}
@@ -581,9 +582,9 @@ public final class RealtimeChannelV2: Sendable {
581
582
public func onBroadcast(
582
583
event: String ,
583
584
callback: @escaping @Sendable ( JSONObject ) -> Void
584
- ) -> Subscription {
585
+ ) -> RealtimeSubscription {
585
586
let id = callbackManager. addBroadcastCallback ( event: event, callback: callback)
586
- return Subscription { [ weak callbackManager, logger] in
587
+ return RealtimeSubscription { [ weak callbackManager, logger] in
587
588
logger? . debug ( " Removing broadcast callback with id: \( id) " )
588
589
callbackManager? . removeCallback ( id: id)
589
590
}
0 commit comments