我有(相信)使用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? */);