Skip to content Skip to sidebar Skip to footer

How To Open The Xmpp Connection In React Native Throughout The Entire App (using Xmpp.js)?

I am using XMPP.js inside react native and using web socket to connect with the xmpp server. I can successfully connect with the chat server but I have to navigate to different pag

Solution 1:

You must open the connection in the starting and use the same connection throughout the entire app. You need to have some class like singleton or so which will hold an xmpp client, so you will use it across the entire app. Or you even can try to hold a global variable inside App.js with xmll client.

For example, here at ConnectyCube ReactNative SDK https://developers.connectycube.com/js/react-native there is a simple prototype object which holds an xmpp client. Then this object can be used in a flux container or as a global variable, something like here How to use global variables in React Native?

Post a Comment for "How To Open The Xmpp Connection In React Native Throughout The Entire App (using Xmpp.js)?"