You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I followed the gqlgen guide on setting up graphql in a Gin project and then tried to also add support for subscriptions.
Everything works flawlessly except for subscriptions.
When testing it out in the playground, I get the following error:
Error: Socket closed with event 1002 RSV1 set, bad opcode 7, bad MASK at Object.error
I am sure I am just missing something or made a mistake in my configuration, but for the life of me, cannot see where.
I created the following graphql handler which includes the AddTransport method for subscriptions:
// graphql.gofuncGraphqlHandler() gin.HandlerFunc {
// NewExecutableSchema and Config are in the generated.go file// Resolver is in the resolver.go fileh:=handler.NewDefaultServer(graph.NewExecutableSchema(graph.Config{Resolvers: &graph.Resolver{}}))
h.AddTransport(&transport.Websocket{}) // <== Added Subscription supportreturnfunc(c*gin.Context) {
h.ServeHTTP(c.Writer, c.Request)
}
}
// Defining the Playground handlerfuncPlaygroundHandler() gin.HandlerFunc {
h:=playground.Handler("GraphQL", "/query")
returnfunc(c*gin.Context) {
h.ServeHTTP(c.Writer, c.Request)
}
}
My routes file:
// routes.gofuncSetupRouter() *gin.Engine {
r:=gin.Default()
// ... removed for brevityr.Any("/query", graphql.GraphqlHandler())
r.GET("/", graphql.PlaygroundHandler())
// ... removed for brevityreturnr
}
I would appreciate any assistance.
Many thanks!
versions
gqlgen version: v0.17.45
go version: go1.21.5 darwin/arm64
The text was updated successfully, but these errors were encountered:
I followed the gqlgen guide on setting up graphql in a Gin project and then tried to also add support for subscriptions.
Everything works flawlessly except for subscriptions.
When testing it out in the playground, I get the following error:
Error: Socket closed with event 1002 RSV1 set, bad opcode 7, bad MASK at Object.error
I am sure I am just missing something or made a mistake in my configuration, but for the life of me, cannot see where.
I created the following graphql handler which includes the AddTransport method for subscriptions:
My routes file:
I would appreciate any assistance.
Many thanks!
versions
v0.17.45
go1.21.5 darwin/arm64
The text was updated successfully, but these errors were encountered: