I developed a game, which will be use socket.io connection, my server is writing in node js, and my android client use socket.io, and now, my question for You is:
how can I switch activities without lost connection with server, i have minimum 4 activities, chat, game view, online players list and more.
When i turn on my app, I create connection, and when I log in to server i would like to switch activity to another.
Any suggestions?
try to make a singleton class SocketIO service
initialize socketio connection at first activity to establish your connection to server, here my example service class
at the first activity i put this code:
it's create object and try connect to server, you can handle it at onConnect or onDisconnect if you want event or something
when you switching activities, you're still connected to server and if you want to close your connection use this :