From 7c28f92581ac83218111b11908fd930d332245c2 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 5 Jul 2024 18:30:36 +0400 Subject: [PATCH] fix: Use graphqlTransportWs to automatically ping server and prevent timeouts --- lib/logic/api_maps/graphql_maps/graphql_api_map.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/logic/api_maps/graphql_maps/graphql_api_map.dart b/lib/logic/api_maps/graphql_maps/graphql_api_map.dart index 0c5ababa..80d345b8 100644 --- a/lib/logic/api_maps/graphql_maps/graphql_api_map.dart +++ b/lib/logic/api_maps/graphql_maps/graphql_api_map.dart @@ -100,8 +100,9 @@ abstract class GraphQLApiMap { Future getSubscriptionClient() async { final WebSocketLink webSocketLink = WebSocketLink( 'ws://api.$rootAddress/graphql', + // Only [GraphQLProtocol.graphqlTransportWs] supports automatic pings, so we don't disconnect when nothing happens. + subProtocol: GraphQLProtocol.graphqlTransportWs, config: SocketClientConfig( - // TODO: Figure out the keep alive pings, as the app disconnects after 30s of inactivity. autoReconnect: true, initialPayload: _token.isEmpty ? null