Stompjs works only in debug mode react-native
See original GitHub issue `const client = new Client({
brokerURL: url
orceBinaryWSFrames: true,
appendMissingNULLonIncoming: true,
logRawCommunication: true,
reconnectDelay: 0, // disable auto reconnect
debug: str => {
console.warn(str);
}
});
` im using RN version: 0.59.9 and stompjs version : ^5.4.2
when the simulator is in debug mode the client gets connected otherwise nothing.
Issue Analytics
- State:
- Created 4 years ago
- Comments:23 (11 by maintainers)
Top Results From Across the Web
StompJs only works in debugging mode - React Native
The connection between the StompJs over WebSocket is established only when the app is in debugging mode. react-native · websocket · stompjs.
Read more >Developers - Stompjs works only in debug mode react-native -
when the simulator is in debug mode the client gets connected otherwise nothing. See More. View in GitHub. SOLVE ISSUE.
Read more >Using STOMP JS
Read along to learn how to use the Stomp object. Create a STOMP client. STOMP JavaScript clients will communicate to a STOMP server...
Read more >React native app only works with debug enabled? - Reddit
Once debug is enabled and there's a connected debugger (Chome or Firefox), the app works normally. Any idea why this is happening?
Read more >STOMP Over WebSocket
It is aimed to run on the WebSockets protocol which is not TCP. ... By default, stomp.js will use the Web browser native...
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
@IlifilzaRusli @mattruddy You can add import statement in your index.js or App.js, anything will work fine. But make sure you have done changes for forceBinaryWSFrames & appendMissingNULLonIncoming also.
And one more thing I would like to add. (For Android development) If your connection to broker is not secured(you are not using any ssl certificate) then connection will not get established. You will find following error log in production build(you can use logcat in production build) but same will work perfectly in debug build.
To overcome from this issue you will have to add following line in your android manifest file to allow unsecure traffic.
android:usesCleartextTraffic="true"
Reference: https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2
By incorporating all four changes… my app is working fine with RabbitMQ broker, even in production build. Changes are: 1. Importing TextEncoder polyfill 2. Setting flags forceBinaryWSFrames & appendMissingNULLonIncoming to true 3. Allowing Unsecure outgoing traffic for the app. 4. Setting “web_stomp.ws_frame = binary” on RabbitMQ broker config [I don’t think it is required. After doing all four changes I verified my app, and it was working. But I have not tried without this change]
Thanks @kum-deepak from great documentation.
I did the first and second steps and it work. Thank you so much.