My (chat) program starts a session almost immediately, then in a separate thread it uses long polling to maintain a connection with it until it receives information.
while(Globals.clientIsLoggedIn) {
...
response = client.execute(getRequest); // waits up to a minute for changes
...
}
(Globals is a set of "global" variables)
Client is my DefaultHTTPClient
I would like to have it concurrently be able to send messages to the server, using the same session!
response = client.execute(postMessageRequest);
...
client.execute(logoffRequest);
I know I must be missing something somewhere, but finding documentation for this (passing a session variable between two different HTTPConnections perhaps?) is a real bear.
Okay, this was while I was still searching for how to explain my problem, let alone answer it. The solution I found is detailed here:
What is a good way to share a session between two HTTPClients in a Java program?