// Sends the session cookie to the server via an RPC to work around browser bugs.
// See: http://code.google.com/p/wave-protocol/issues/detail?id=119
String token = Cookies.getCookie(JETTY_SESSION_TOKEN_NAME);
if (token != null) {
ProtocolAuthenticateJsoImpl auth = ProtocolAuthenticateJsoImpl.create();
auth.setToken(token);
send(MessageWrapper.create(sequenceNo++, "ProtocolAuthenticate", auth));
}
// Flush queued messages.
while (!messages.isEmpty() && connected == ConnectState.CONNECTED) {