ddp-apollo
ddp-apollo copied to clipboard
meteor/meteor and apollo-link-http are needed to use apollo-link-ddp
I have a react-native project and want to use apollo-link-ddp with simpleddp but I'm getting following error:
Error: Unable to resolve module meteor/meteorfromnode_modules/apollo-link-ddp/dist/client/apollo-link-ddp.js: meteor/meteor could not be found within the project.
Is there some kind of workaround? Here is my current code:
import { ApolloClient, InMemoryCache } from '@apollo/client';
import SimpleDDP from 'simpleddp';
import { simpleDDPLogin } from 'simpleddp-plugin-login';
import { DDPLink } from 'apollo-link-ddp';
const ddp = new SimpleDDP({
endpoint: 'ws://localhost:3000/websocket',
SocketConstructor: global.WebSocket,
reconnectInterval: 5000,
}, [simpleDDPLogin]);
const client = new ApolloClient({
link: new DDPLink({
connection: ddp,
socket: ddp.ddpConnection.socket,
}),
cache: new InMemoryCache(),
});
Hello @durac.
Current version of apollo-link-ddp is not compatible with Apollo Client 3.0.
@moberegger proposed a pull request (#392) to make it compatible, let's hope it will be merged quickly.