Speed up message sending
Sending a message seems to include a ssl handshake with the ts server. This expensive operation is problematic in areas with limited coverage or overloaded cells (such as in a demonstration or today's carnival). It can take minutes for a message to be sent. Receiving (via gcm) is much faster.
Can we speed this up? Maybe keep the socket open for a while? Use some faster re-negotiation? Or do some crypto magic instead of ssl? :-)
Just an idea: Apparently GCM supports upstream messages as well:
Using CCS and the GoogleCloudMessaging API, you can send messages from a user's device to the cloud. (http://developer.android.com/google/gcm/ccs.html)
Maybe this could work as a faster/cheaper alternative upstream channel? As I understand it, the socket is already open, so sending is (almost) free. Might be interesting for delivery notifications as well (#957)
That's a XMPP connection that's being kept open. I don't think this would suit our use case well. Theoretically, one could think about downgrading from https to http. I don't think that that would leak information (since we're encrypting anyways), and connection setup could be a bit faster...
Hey @vascorppor I think it's a potentially good idea, but my reservations are:
- Right now GCM has an asymmetric view of the traffic, which I believe is nice from a traffic analysis perspective.
- GCM has proven to be somewhat unreliable so far. People in some regions or with some devices seem to have difficulty receiving GCM messages, which makes me wonder how much we should increase our dependence on it. Presumably messages to the server would be more reliable, but I'd want to test that assumption.
- It's more code on the server side. We're currently using their HTTP interface, so switching to the CCS interface would be a non-trivial change. It's definitely possible (and perhaps preferable one way or another), but there's some initial work required before even testing the client side change.
My sense is that the HTTPS interface we're using right now is doing any type of TLS session resumption, so I think my first step will be to work that in and see what kind of improvement we get that way.
I'm having this problem too. This is hardly bearable on slowish connections (like on a not-so-fast public wifi). If you quickly send something like 10-20 messages, it takes several seconds to send them all. On whatsapp, it sends all of them in about one second.
As of ec5ac44cd36907653b03c4cecbb9a82c9fdb0b66, messages are sent and received over a single WebSocket connection. Should this be closed?