我想改变graphql中的graphql websocket端点,有人知道怎么做吗?
默认情况下,它会 ping
wss://localhost/graphql
我需要将其更改为推送器 url
谢谢 :-)
最佳答案
如果您正在运行 GraphQL Playground 的独立实例,则 URL 将作为 Prop 直接传递给组件:
<Playground
endpoint="http://localhost/graphql"
subscriptionEndpoint="wss://localhost/graphql"
/>
如果您使用
apollo-server
,端点 URL 应该来自 subscriptionsPath
,但也可以直接在配置中设置:const server = new ApolloServer({
typeDefs,
resolvers,
playground: {
subscriptionEndpoint: 'wss://localhost/graphql',
},
});
编辑:
似乎没有办法使用特定订阅 URL 配置桌面客户端,除非您将它与包含
.graphqlconfig
的本地存储库一起使用。 .在这种情况下,您可以在配置文件中提供有关您的环境的其他信息,包括订阅 URL,如 here 所述。 .
关于graphql - 如何在 graphql-playground 中更改 websocket url(订阅),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55102126/