I'm trying to connect, as the question suggests, an Android device to a Digest secured server with websockets but I keep getting 401 Unauthorized returns.
I have managed to POST and GET to the same server using apache.http (which supports Digest) and can continue to send these basic commands by returning the cookies received during the initial request but these same cookies don't work when I send them with the websocket handshake.
I've sniffed the packets and can see that, as expected, even the successful connection starts with a 401 from which the apache library extracts the necessary information and resends an Authorization header with all the Digest hashes etc. This returns a new, approved response with the cookies that I'm grabbing and storing for future use.
My assumption is that in the change from an http:// address to a ws:// address I need to reauthenticate but I haven't found an android websocket library that supports authentication and those that i have found and tested don't let me see the server's 401 response (again, seen that it exists by sniffing the packets between the two and it contains all the information I need to generate a new Digest response even if that means writing it myself).
Any help/suggestions would be gratefully appreciated.
Relevant but unsuccessful questions I still have open:
Open WebSocket connection with authentication cookie
Websockets and cookies in Android
Tested Libraries:
Autobahn
AndroidAsync
Java-Websocket (Currently pushing on with this)