@@ -64,6 +64,7 @@ extension Socket {
6464}
6565
6666public final class RealtimeChannelV2 : Sendable {
67+ @available ( * , deprecated, renamed: " RealtimeSubscription " )
6768 public typealias Subscription = ObservationToken
6869
6970 public enum Status : Sendable {
@@ -464,9 +465,9 @@ public final class RealtimeChannelV2: Sendable {
464465 /// Listen for clients joining / leaving the channel using presences.
465466 public func onPresenceChange(
466467 _ callback: @escaping @Sendable ( any PresenceAction ) -> Void
467- ) -> Subscription {
468+ ) -> RealtimeSubscription {
468469 let id = callbackManager. addPresenceCallback ( callback: callback)
469- return Subscription { [ weak callbackManager, logger] in
470+ return RealtimeSubscription { [ weak callbackManager, logger] in
470471 logger? . debug ( " Removing presence callback with id: \( id) " )
471472 callbackManager? . removeCallback ( id: id)
472473 }
@@ -479,7 +480,7 @@ public final class RealtimeChannelV2: Sendable {
479480 table: String ? = nil ,
480481 filter: String ? = nil ,
481482 callback: @escaping @Sendable ( AnyAction ) -> Void
482- ) -> Subscription {
483+ ) -> RealtimeSubscription {
483484 _onPostgresChange (
484485 event: . all,
485486 schema: schema,
@@ -497,7 +498,7 @@ public final class RealtimeChannelV2: Sendable {
497498 table: String ? = nil ,
498499 filter: String ? = nil ,
499500 callback: @escaping @Sendable ( InsertAction ) -> Void
500- ) -> Subscription {
501+ ) -> RealtimeSubscription {
501502 _onPostgresChange (
502503 event: . insert,
503504 schema: schema,
@@ -516,7 +517,7 @@ public final class RealtimeChannelV2: Sendable {
516517 table: String ? = nil ,
517518 filter: String ? = nil ,
518519 callback: @escaping @Sendable ( UpdateAction ) -> Void
519- ) -> Subscription {
520+ ) -> RealtimeSubscription {
520521 _onPostgresChange (
521522 event: . update,
522523 schema: schema,
@@ -535,7 +536,7 @@ public final class RealtimeChannelV2: Sendable {
535536 table: String ? = nil ,
536537 filter: String ? = nil ,
537538 callback: @escaping @Sendable ( DeleteAction ) -> Void
538- ) -> Subscription {
539+ ) -> RealtimeSubscription {
539540 _onPostgresChange (
540541 event: . delete,
541542 schema: schema,
@@ -553,7 +554,7 @@ public final class RealtimeChannelV2: Sendable {
553554 table: String ? ,
554555 filter: String ? ,
555556 callback: @escaping @Sendable ( AnyAction ) -> Void
556- ) -> Subscription {
557+ ) -> RealtimeSubscription {
557558 precondition (
558559 status != . subscribed,
559560 " You cannot call postgresChange after joining the channel "
@@ -571,7 +572,7 @@ public final class RealtimeChannelV2: Sendable {
571572 }
572573
573574 let id = callbackManager. addPostgresCallback ( filter: config, callback: callback)
574- return Subscription { [ weak callbackManager, logger] in
575+ return RealtimeSubscription { [ weak callbackManager, logger] in
575576 logger? . debug ( " Removing postgres callback with id: \( id) " )
576577 callbackManager? . removeCallback ( id: id)
577578 }
@@ -581,9 +582,9 @@ public final class RealtimeChannelV2: Sendable {
581582 public func onBroadcast(
582583 event: String ,
583584 callback: @escaping @Sendable ( JSONObject ) -> Void
584- ) -> Subscription {
585+ ) -> RealtimeSubscription {
585586 let id = callbackManager. addBroadcastCallback ( event: event, callback: callback)
586- return Subscription { [ weak callbackManager, logger] in
587+ return RealtimeSubscription { [ weak callbackManager, logger] in
587588 logger? . debug ( " Removing broadcast callback with id: \( id) " )
588589 callbackManager? . removeCallback ( id: id)
589590 }
0 commit comments