Connection issue in React Native
See original GitHub issueOpened on behalf of @hdvreyes:
I can’t seem to establish a connection unless my debugger is on. Am running on “react-native”: “0.63.4” and “@stomp/stompjs”: “^6.0.0”. ` const client = Stomp.over(function() { return new SockJS(socketUrl); });
client.reconnectDelay = 10000; client.heartbeatIncoming = 5000; client.heartbeatOutgoing = 5000; client.forceBinaryWSFrames = true; client.appendMissingNULLonIncoming = true;
client.connect(headers, () => {
client.subscribe(topic, callback, headers);
});
` Has anyone encountered the same issue? thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Managing network connection status in React Native
Effortlessly handle network connection state changes in a React Native app by utilizing NetInfo and Axios for a more resilient product.
Read more >Troubleshooting - React Native
These are some common issues you may run into while setting up React Native. If you encounter something that is not listed here,...
Read more >How to Handle Network Connection in Your React Native ...
Your app may need to detect the user's internet connectivity at times. If the user is offline or doesn't have access to a...
Read more >Intermittent JavaScript-side connection issues on ... - GitHub
Description We have been observing sporadic extreme network slowness in React Native that occurs on some network requests only on android ...
Read more >Network connection problem in react native - Stack Overflow
I am trying to run react native app on android using expo cli. But getting this network connection error.network connection problem Image is ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Usually, it happens because of missing polyfills. This is a peculiar issue, in debug mode, React Native uses a full browser which is not the case in production mode. That causes the list of polyfills to be different in both modes. Please see https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html#in-react-native
Few topics related to React Native has been compiled at https://stomp-js.github.io/workaround/stompjs/rx-stomp/ng2-stompjs/react-native-additional-notes.html
Please let me know if it helps.
In addition,
Stomp.over
andclient.connect
are v4 syntax and are available as compatibility, i.e., mixing of newer features may not work. Please see https://stomp-js.github.io/#upgrading and https://stomp-js.github.io/#getting-started.I am sorry, I am unable to suggest anything more than https://stomp-js.github.io/workaround/stompjs/rx-stomp/ng2-stompjs/react-native-additional-notes.html. Please try the first approach. It may not help, but try adding
client.forceBinaryWSFrames = true;