Apollo Client Full WebSocket Transport 给我错误 this.networkInterface.query is not a function
Apollo Client Full WebSocket Transport gives me the error this.networkInterface.query is not a function
我可以使用混合方法,但我想使用完整的 websocket 传输,其中每个 graphql 操作都通过套接字完成。我完全喜欢他们的 documentation.
import { SubscriptionClient } from 'subscriptions-transport-ws'
import ApolloClient from 'apollo-client'
import gql from 'graphql-tag'
const client = new SubscriptionClient('ws://localhost:5000/graphql', { reconnect: true })
const apolloClient = new ApolloClient({ networkInterface: client })
apolloClient.query({
query: gql`query { app }`
})
给我错误:
Uncaught (in promise) Error: Network error: this.networkInterface.query is not a function
at new ApolloError (ApolloError.js:34)
at QueryManager.js:325
at QueryManager.js:818
at Array.forEach (<anonymous>)
at QueryManager.js:815
at Array.forEach (<anonymous>)
at QueryManager.broadcastQueries (QueryManager.js:812)
at QueryManager.js:281
at <anonymous>
subscriptions-transport-ws 在 0.9.x 版本中有一些重大变化。您可以安装 0.8.3 或尝试使用较新的版本。
我可以使用混合方法,但我想使用完整的 websocket 传输,其中每个 graphql 操作都通过套接字完成。我完全喜欢他们的 documentation.
import { SubscriptionClient } from 'subscriptions-transport-ws'
import ApolloClient from 'apollo-client'
import gql from 'graphql-tag'
const client = new SubscriptionClient('ws://localhost:5000/graphql', { reconnect: true })
const apolloClient = new ApolloClient({ networkInterface: client })
apolloClient.query({
query: gql`query { app }`
})
给我错误:
Uncaught (in promise) Error: Network error: this.networkInterface.query is not a function
at new ApolloError (ApolloError.js:34)
at QueryManager.js:325
at QueryManager.js:818
at Array.forEach (<anonymous>)
at QueryManager.js:815
at Array.forEach (<anonymous>)
at QueryManager.broadcastQueries (QueryManager.js:812)
at QueryManager.js:281
at <anonymous>
subscriptions-transport-ws 在 0.9.x 版本中有一些重大变化。您可以安装 0.8.3 或尝试使用较新的版本。