Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Speed up message sending

Open lablans opened this issue 12 years ago • 5 comments

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? :-)

lablans avatar Mar 03 '14 21:03 lablans

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)

lablans avatar Mar 15 '14 00:03 lablans

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...

tinloaf avatar Mar 15 '14 01:03 tinloaf

Hey @vascorppor I think it's a potentially good idea, but my reservations are:

  1. Right now GCM has an asymmetric view of the traffic, which I believe is nice from a traffic analysis perspective.
  2. 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.
  3. 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.

moxie0 avatar Mar 15 '14 03:03 moxie0

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.

ghost avatar Dec 23 '15 10:12 ghost

As of ec5ac44cd36907653b03c4cecbb9a82c9fdb0b66, messages are sent and received over a single WebSocket connection. Should this be closed?

nrizzio avatar Jan 16 '17 16:01 nrizzio