i'm using Apollo graphgql Client for front-end and gqlgen for my bff service here's my Apollo configuration code:
const wsLink = new GraphQLWsLink(createClient({
url: 'ws://localhost:8080/'}))
and here is how i created my graphql server:
srv := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: &resolvers.Resolver{}}))
srv.AddTransport(&transport.Websocket{})
srv.AddTransport(transport.POST{})
if helpers.Env("MODE") == "PRODUCTION" {
cache, err := apq.NewCache(24 * time.Hour)
if err != nil {
log.Fatalf("cannot create APQ redis cache: %v", err)
}
srv.Use(extension.AutomaticPersistedQuery{Cache: cache})
}
router.Handle("/", srv)
if helpers.Env("MODE") == "DEVELOPMENT" {
router.Handle("/playground", playground.Handler("GraphQL playground", "/"))
log.Printf("connect to http://localhost:%s/playground for GraphQL playground", port)
}
log.Fatal(http.ListenAndServe(":"+port, router))
any idea how to fix this error?
i tried replacing 'ws://localhost:8080/'
with ws://localhost:8080/subscriptions
and ws://localhost:8080/graphql
and ws://myIP:8080/
but non of them worked