My app lets users connect to each other to share messages and such using streamsockets.
The app has a streamSocket Listener that, when the onConnectionReceived
is called, it returns the socket that is connecting and sending a request to the app.
The app will have MANY sockets connecting to it, each socket will be carrying different requests the app must carry out.
My questions are:
What is the best practice for saving these Socket connections so i can reuse them later and write to them?
How can i have my app handle each connections request seperatly and at the same time? Meaning, i dont want my app writing a response to the wrong streamsocket that sent the request.