Graphql 订阅客户端 http 请求
Graphql subscriptions client-side http request
是否可以使用简单的 http 请求进行订阅,类似于查询,突变,我只需要发送一个 "application/graphql" 带有 "application/graphql" 内容类型和正文的请求?
不行,做不到
在 GraphQL 中,subscriptions
正在订阅 websocket
并监听数据变化,它会对自定义事件做出反应,因此您无法使用 POST 请求进行查询.
如 Apollo Client Subscriptions 处的文档所述。
Now, queries and mutations will go over HTTP as normal, but subscriptions will be done over the websocket transport.
是否可以使用简单的 http 请求进行订阅,类似于查询,突变,我只需要发送一个 "application/graphql" 带有 "application/graphql" 内容类型和正文的请求?
不行,做不到
在 GraphQL 中,subscriptions
正在订阅 websocket
并监听数据变化,它会对自定义事件做出反应,因此您无法使用 POST 请求进行查询.
如 Apollo Client Subscriptions 处的文档所述。
Now, queries and mutations will go over HTTP as normal, but subscriptions will be done over the websocket transport.