Cannot send a message. Unknown Websocket id 2
Hello. I imported your example code to my project and I got this message Cannot send a message. Unknown Websocket id 2
Hi @jurajkrivda!
Hm, I haven't seen this issue before. Can you please provide the code which is failing? It'll help me to figure out what went wrong.
Thanks in advance 🚀
Hello @Kureev here you are:
import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import { ApolloProvider } from 'react-apollo';
import SplashScreen from 'react-native-splash-screen';
import Layout from './routes';
import client from './apollo/client';
import createStore from './store/store';
import { AlertProvider } from './components/Alert';
import { start as startNetworkDebugging } from 'react-native-network-proxy';
startNetworkDebugging();
const store = createStore(client);
class App extends Component { // eslint-disable-line
componentDidMount() {
SplashScreen.hide();
}
render() {
return (
<ApolloProvider
client={ client }
store={ store }
>
<AlertProvider>
<Layout />
</AlertProvider>
</ApolloProvider>
);
}
}
console.disableYellowBox = true;
AppRegistry.registerComponent('App', () => App);
Almost forgot. This error is only displayed when you request a GraphQL mutation or query. I use Apollo client.
Thanks for the code! I'll try to reproduce it in a few hours and report back.
Hi @jurajkrivda!
I finally found some time to investigate this issue (even though it tool longer than I expected). I've tried to use https://github.com/apollographql/frontpage-react-native-app as an example of an average RN + Apollo app and it seems to work.
There is one thing you might miss:
- In the readme, after installation instruction, there is a command
yarn react-native-network-proxy. Are you sure you run it?
Nevertheless, I found a header encoding issue. But that's a different topic for discussion.
Can you please double-check your setup one more time so we can find an another way to fix the problem?
Hi @Kureev!
I'm sure of my configuration. After I installed this library I started proxy with yarn react-native-network-proxy. I use the latest React Native version but version 0.33 is used in your Apollo example. Could you upgrade your dependencies? I also send authorization tokens in all requests headers.
Unfortunately, it isn't my repo. I updated dependencies manually in order to make it work with react-native-network-proxy (XHRInterceptor has been introduced in the latest versions). I'll create an examples folder and add apollo example there.
@Kureev Thank you.
this appears to be an issue with react-native https://github.com/facebook/react-native/issues/17494