Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 921318e

Browse files
committed
Subscription timeout prop configured to prevent reconnect fix #181
1 parent 69c65cf commit 921318e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

graphiql-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/graphiql/boot/GraphiQLController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public class GraphiQLController {
5151
@Value("${graphiql.cdn.version:0.11.11}")
5252
private String graphiqlCdnVersion;
5353

54+
@Value("${graphiql.subscriptions.timeout:30}")
55+
private int subscriptionsTimeout;
56+
5457
@Autowired
5558
private Environment environment;
5659

@@ -113,6 +116,7 @@ private Map<String, String> getReplacements(String graphqlEndpoint, String subsc
113116
replacements.put("graphiqlJsUrl", graphiqlUrl(staticBasePath, "graphiql.min.js"));
114117
replacements.put("props", props);
115118
replacements.put("headers", headers);
119+
replacements.put("subscriptionClientTimeout", String.valueOf(subscriptionsTimeout));
116120
return replacements;
117121
}
118122

graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
newUri += "//" + loc.host;
124124
newUri += "${subscriptionsEndpoint}";
125125

126-
var subscriptionsClient = new window.SubscriptionsTransportWs.SubscriptionClient(newUri, { reconnect: true });
126+
var subscriptionsClient = new window.SubscriptionsTransportWs.SubscriptionClient(newUri, { reconnect: true, timeout: ${subscriptionClientTimeout} });
127127
var subscriptionsFetcher = window.GraphiQLSubscriptionsFetcher.graphQLFetcher(subscriptionsClient, graphQLFetcher);
128128

129129
var props = ${props};

0 commit comments

Comments
 (0)