mirror of
https://github.com/wassname/talk.git
synced 2026-07-31 12:50:48 +08:00
[next] Websocket Keep Alive (#2394)
* feat: added keepalive config * fix: format * fix: adjusted client timeout default * Update server.ts
This commit is contained in:
@@ -223,6 +223,13 @@ export function createSubscriptionServer(
|
||||
schema: GraphQLSchema,
|
||||
options: Options
|
||||
) {
|
||||
const keepAlive = options.config.get("websocket_keep_alive_timeout");
|
||||
if (typeof keepAlive !== "number" || keepAlive <= 0) {
|
||||
throw new Error(
|
||||
"expected the websocket_keep_alive_timeout configuration to be a positive number"
|
||||
);
|
||||
}
|
||||
|
||||
return SubscriptionServer.create(
|
||||
{
|
||||
schema,
|
||||
@@ -230,6 +237,7 @@ export function createSubscriptionServer(
|
||||
subscribe,
|
||||
onConnect: onConnect(options),
|
||||
onOperation: onOperation(options),
|
||||
keepAlive,
|
||||
},
|
||||
{
|
||||
server,
|
||||
|
||||
Reference in New Issue
Block a user