How to open the XMPP connection in react native throughout the entire app (using xmpp.js)?
up vote
0
down vote
favorite
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 pages inside the App so I have 2 options:
I must open a new XMPP connection to the xmpp chat server everytime I navigate to a new page (using react Navigation for navigating) and close the old connection [I think its not recommended] or
I must open the connection in the starting and use the same connection throughout the entire app. But how to achieve that?
Is there any alternative like services in react native with which I can open the XMPP connection in the backend and it must work throughout the entire app. I need the feasible solution for both Android+IOS
add a comment |
up vote
0
down vote
favorite
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 pages inside the App so I have 2 options:
I must open a new XMPP connection to the xmpp chat server everytime I navigate to a new page (using react Navigation for navigating) and close the old connection [I think its not recommended] or
I must open the connection in the starting and use the same connection throughout the entire app. But how to achieve that?
Is there any alternative like services in react native with which I can open the XMPP connection in the backend and it must work throughout the entire app. I need the feasible solution for both Android+IOS
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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 pages inside the App so I have 2 options:
I must open a new XMPP connection to the xmpp chat server everytime I navigate to a new page (using react Navigation for navigating) and close the old connection [I think its not recommended] or
I must open the connection in the starting and use the same connection throughout the entire app. But how to achieve that?
Is there any alternative like services in react native with which I can open the XMPP connection in the backend and it must work throughout the entire app. I need the feasible solution for both Android+IOS
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 pages inside the App so I have 2 options:
I must open a new XMPP connection to the xmpp chat server everytime I navigate to a new page (using react Navigation for navigating) and close the old connection [I think its not recommended] or
I must open the connection in the starting and use the same connection throughout the entire app. But how to achieve that?
Is there any alternative like services in react native with which I can open the XMPP connection in the backend and it must work throughout the entire app. I need the feasible solution for both Android+IOS
asked Nov 2 at 7:42
Shubham1164
436
436
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
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?
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
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?
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
add a comment |
up vote
1
down vote
accepted
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?
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
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?
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?
answered Nov 10 at 15:05
Rubycon
15.6k83658
15.6k83658
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
add a comment |
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
Hi Ruby, on your reference, I have started using xmpp.js for xmpp chat but I am unable to perform stream management with it. Please read the complete question here [stackoverflow.com/q/53257285/3102733]
– Shubham1164
Nov 12 at 7:08
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53114492%2fhow-to-open-the-xmpp-connection-in-react-native-throughout-the-entire-app-using%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown