File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
Sources/LiveViewNative/Coordinators Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -266,15 +266,7 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
266266 }
267267 }
268268
269- let liveChannel = try await self . liveSocket!. joinLiveviewChannel (
270- . some( [
271- " _format " : . str( string: LiveSessionParameters . platform) ,
272- " _interface " : . object( object: LiveSessionParameters . platformParams)
273- ] ) ,
274- nil
275- )
276-
277- self . navigationPath. last!. coordinator. join ( liveChannel)
269+ try await self . joinLiveViewChannel ( )
278270
279271 self . state = . connected
280272
@@ -328,6 +320,18 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
328320
329321 }
330322 }
323+
324+ func joinLiveViewChannel( ) async throws {
325+ let liveChannel = try await self . liveSocket!. joinLiveviewChannel (
326+ . some( [
327+ " _format " : . str( string: LiveSessionParameters . platform) ,
328+ " _interface " : . object( object: LiveSessionParameters . platformParams)
329+ ] ) ,
330+ nil
331+ )
332+
333+ self . navigationPath. last? . coordinator. join ( liveChannel)
334+ }
331335
332336 private func disconnect( preserveNavigationPath: Bool = false ) async {
333337 do {
Original file line number Diff line number Diff line change @@ -270,6 +270,9 @@ public class LiveViewCoordinator<R: RootRegistry>: ObservableObject {
270270 guard !Task. isCancelled else { return }
271271 do {
272272 switch event. event {
273+ case . phoenix( phoenix: . error) :
274+ logger. error ( " encountered error in reply - channel reconnecting " ) ;
275+ try await session. joinLiveViewChannel ( )
273276 case . user( user: " diff " ) :
274277 switch event. payload {
275278 case let . jsonPayload( json) :
You can’t perform that action at this time.
0 commit comments