Skip to content

Commit

Permalink
add PingPongInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
maeglindeveloper committed Apr 13, 2021
1 parent 35b80a7 commit d3ba467
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc
Upgrader: cfg.upgrader,
InitFunc: cfg.websocketInitFunc,
KeepAlivePingInterval: cfg.connectionKeepAlivePingInterval,
PingPongInterval: cfg.connectionPingPongInterval,
})
srv.AddTransport(transport.Options{})
srv.AddTransport(transport.GET{})
Expand Down Expand Up @@ -77,6 +78,7 @@ type Config struct {
upgrader websocket.Upgrader
websocketInitFunc transport.WebsocketInitFunc
connectionKeepAlivePingInterval time.Duration
connectionPingPongInterval time.Duration
recover graphql.RecoverFunc
errorPresenter graphql.ErrorPresenterFunc
fieldHooks []graphql.FieldMiddleware
Expand Down Expand Up @@ -210,6 +212,12 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option {
}
}

func WebsocketPingPongDuration(duration time.Duration) Option {
return func(cfg *Config) {
cfg.connectionPingPongInterval = duration
}
}

// Add cache that will hold queries for automatic persisted queries (APQ)
// Deprecated: switch to graphql/handler.New
func EnablePersistedQueryCache(cache PersistedQueryCache) Option {
Expand Down

0 comments on commit d3ba467

Please sign in to comment.