1
Fork 0

Reconnect custom websocket upgrader

This commit is contained in:
viktorstrate 2022-02-07 18:15:47 +01:00
parent d235a7e352
commit 5ffc1a57dd
No known key found for this signature in database
GPG Key ID: 3F855605109C1E8A
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/99designs/gqlgen/graphql/handler/transport" "github.com/99designs/gqlgen/graphql/handler/transport"
photoview_graphql "github.com/photoview/photoview/api/graphql" photoview_graphql "github.com/photoview/photoview/api/graphql"
"github.com/photoview/photoview/api/graphql/resolvers" "github.com/photoview/photoview/api/graphql/resolvers"
"github.com/photoview/photoview/api/server"
"github.com/photoview/photoview/api/utils" "github.com/photoview/photoview/api/utils"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -27,6 +28,7 @@ func GraphqlEndpoint(db *gorm.DB) *graphql_handler.Server {
graphqlServer := graphql_handler.New(photoview_graphql.NewExecutableSchema(graphqlConfig)) graphqlServer := graphql_handler.New(photoview_graphql.NewExecutableSchema(graphqlConfig))
graphqlServer.AddTransport(transport.Websocket{ graphqlServer.AddTransport(transport.Websocket{
KeepAlivePingInterval: 10 * time.Second, KeepAlivePingInterval: 10 * time.Second,
Upgrader: server.WebsocketUpgrader(utils.DevelopmentMode()),
}) })
graphqlServer.AddTransport(transport.Options{}) graphqlServer.AddTransport(transport.Options{})
graphqlServer.AddTransport(transport.GET{}) graphqlServer.AddTransport(transport.GET{})