Apollo GraphQL客户端获取查询结果

时间:2019-06-17 19:24:35

标签: node.js websocket graphql apollo apollo-client

我有(相信)使用Apollo客户端使用Web套接字协议建立与graphQL端点的连接的代码。但是,我不知道如何实际访问返回的数据。相关行将是

const client = new SubscriptionClient(GRAPHQL_ENDPOINT, {
  reconnect: true
}, ws);
const link = new WebSocketLink(client);
const cache = new InMemoryCache.InMemoryCache();

const apolloClient = new ApolloClient.ApolloClient({
  networkInterface: client,
  link: link,
  cache: cache,
});

apolloClient.query({
  query: QUERY,
}).then(/* what goes here? */);

0 个答案:

没有答案