From 5527ceb07da3a5d0cffc1256bc4f7642e9c7cc77 Mon Sep 17 00:00:00 2001 From: Michael Law <1365977+lawmicha@users.noreply.github.com> Date: Tue, 14 Nov 2023 05:58:04 -0500 Subject: [PATCH] fix logic --- .../RealtimeConnectionProviderAsync+Websocket.swift | 3 +++ .../Websocket/Starscream/StarscreamAdapter.swift | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/AppSyncRealTimeClient/ConnectionProvider/AppsyncRealtimeConnectionAsync/RealtimeConnectionProviderAsync+Websocket.swift b/AppSyncRealTimeClient/ConnectionProvider/AppsyncRealtimeConnectionAsync/RealtimeConnectionProviderAsync+Websocket.swift index a565a3d6..f2d91e3d 100644 --- a/AppSyncRealTimeClient/ConnectionProvider/AppsyncRealtimeConnectionAsync/RealtimeConnectionProviderAsync+Websocket.swift +++ b/AppSyncRealTimeClient/ConnectionProvider/AppsyncRealtimeConnectionAsync/RealtimeConnectionProviderAsync+Websocket.swift @@ -31,6 +31,9 @@ extension RealtimeConnectionProviderAsync: AppSyncWebsocketDelegate { return } #if os(watchOS) + AppSyncLogger.debug( + "[RealtimeConnectionProvider] on watchOS, received disconnect." + ) self.updateCallback(event: .error(ConnectionProviderError.connection( "This API uses low-level networking (websockets). Running on watchOS only works for specific circumstances.", error))) diff --git a/AppSyncRealTimeClient/Websocket/Starscream/StarscreamAdapter.swift b/AppSyncRealTimeClient/Websocket/Starscream/StarscreamAdapter.swift index b7400c9d..23fab3db 100644 --- a/AppSyncRealTimeClient/Websocket/Starscream/StarscreamAdapter.swift +++ b/AppSyncRealTimeClient/Websocket/Starscream/StarscreamAdapter.swift @@ -68,7 +68,8 @@ public class StarscreamAdapter: AppSyncWebsocketProvider { AppSyncLogger.debug( "[StarscreamAdapter] Manually send disconnect." ) - self.delegate?.websocketDidDisconnect(provider: self, error: nil) + let error = ConnectionProviderError.connection("WatchOS Error", nil) + delegate?.websocketDidDisconnect(provider: self, error: error) } else { AppSyncLogger.debug( "[StarscreamAdapter] watchOS subscriptions are connected within 3s."