Graphql 您正在通过终止链接调用concat,这在apollo中没有效果
我有密码:Graphql 您正在通过终止链接调用concat,这在apollo中没有效果,graphql,apollo,apollo-client,Graphql,Apollo,Apollo Client,我有密码: import { ApolloClient, ApolloLink, InMemoryCache, from, HttpLink } from '@apollo/client'; import { WebSocketLink } from '@apollo/client/link/ws'; import { SubscriptionClient } from 'subscriptions-transport-ws'; import { HOST, SSL_ENABLED } fro
import { ApolloClient, ApolloLink, InMemoryCache, from, HttpLink } from '@apollo/client';
import { WebSocketLink } from '@apollo/client/link/ws';
import { SubscriptionClient } from 'subscriptions-transport-ws';
import { HOST, SSL_ENABLED } from './config';
const uri = (protocol: string) => `${protocol}://${HOST}/graphql`;
export default function apolloClient(token?: string | null): any {
const link = from([
new ApolloLink((operation, forward) => {
operation.setContext({
headers: {
...token && { Authorization: `Bearer ${token}` } || {},
},
});
return forward(operation);
}),
new WebSocketLink(new SubscriptionClient(uri(`ws${SSL_ENABLED ? 's' : ''}`), {
reconnect: true,
})),
new HttpLink({ uri: uri(`http${SSL_ENABLED ? 's' : ''}`) }),
]);
return new ApolloClient({
link,
cache: new InMemoryCache(),
});
}
我收到一个警告您正在终止链接上调用concat,这将不会有任何效果。此外,任何请求都不会从我的应用程序发送到我的api
当我搬走的时候
new WebSocketLink(new SubscriptionClient(uri(`ws${SSL_ENABLED ? 's' : ''}`), {
reconnect: true,
})),
一切正常,应用程序正在工作(发送请求),没有任何警告
怎么了