【发布时间】:2019-08-01 18:47:30
【问题描述】:
我想在graphql中更改graphql websocket端点,有人知道怎么做吗?
默认是ping
wss://localhost/graphql
我需要将其更改为推送器网址
谢谢 :-)
【问题讨论】:
-
你在使用
apollo-server-express吗?您能否提供更多关于您如何实施服务器的信息?
标签: graphql graphql-subscriptions
我想在graphql中更改graphql websocket端点,有人知道怎么做吗?
默认是ping
wss://localhost/graphql
我需要将其更改为推送器网址
谢谢 :-)
【问题讨论】:
apollo-server-express吗?您能否提供更多关于您如何实施服务器的信息?
标签: graphql graphql-subscriptions
如果您正在运行 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 所述。
【讨论】: