Skip to content

Commit

Permalink
Added realtime callback whenever connection state changes, send conne…
Browse files Browse the repository at this point in the history
…ction id
  • Loading branch information
sacOO7 committed Feb 23, 2024
1 parent 5dddbe2 commit 09c3275
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ios/Classes/AblyFlutter.m
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ -(void)reset;
ARTRealtime *const realtime = [[ARTRealtime alloc] initWithOptions:options.clientOptions];
[instanceStore setRealtime:realtime with:handle];

[realtime.connection on:^(ARTConnectionStateChange *stateChange) {
AblyFlutterMessage *const message
= [[AblyFlutterMessage alloc] initWithMessage:[realtime.connection id] handle: handle];
[ably.channel invokeMethod:AblyPlatformMethod_connectionIdUpdated
arguments:message]
}];

// Giving Ably client the deviceToken registered at device launch (didRegisterForRemoteNotificationsWithDeviceToken).
// This is not an ideal solution. We save the deviceToken given in didRegisterForRemoteNotificationsWithDeviceToken and the
// error in didFailToRegisterForRemoteNotificationsWithError and pass it to Ably in the first client that is first created.
Expand Down

0 comments on commit 09c3275

Please sign in to comment.