Commit graph

14 commits

Author SHA1 Message Date
lilia
8fdf58971c Add missing semicolons
// FREEBIE
2016-02-24 23:10:17 -08:00
lilia
9be5efc571 Simplify keepalive resets
Websocket resources should have their keepalive timers reset whenever a
message comes in. This is a nicety that slightly reduces the amount of
traffic we send when actively messaging.

Previously this was handled by MessageReceiver, but it's a bit cleaner
to just have the WebsocketResource add an extra 'message' event handler.

// FREEBIE
2015-10-23 15:44:03 -07:00
lilia
0ff38e41c2 Let keepalive listen to socket events
Wait until the socket connects before starting the keepalive timer.
Automatically stop the keepalive when the socket is closed.

// FREEBIE
2015-10-05 15:05:24 -07:00
lilia
78956ede2f Disable keepalive if we disconnect the socket 2015-10-01 18:33:48 -07:00
lilia
b8536679b3 Stop keepalive when socket closes
// FREEBIE
2015-09-30 14:21:10 -07:00
lilia
f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00
lilia
2b563212b4 Change default for keepalive autodisconnect config
By default, automatically disconnect if no response. This is preferable
because we can sometimes lose connectivity without receiving a close
event from the socket, but it's also possible that the endpoint may not
support responses.

// FREEBIE
2015-07-29 11:30:58 -07:00
lilia
1af8bd16b7 Add default response message to websocketresources
// FREEBIE
2015-07-28 14:57:09 -07:00
lilia
637cbcbf99 Make handleRequest optional in WebSocketResources
If no request handler is provided, respond with 404 to any incoming
requests.
2015-07-28 13:48:27 -07:00
lilia
cd363bd84d Integrate keepalives into websocket resources 2015-07-28 13:07:34 -07:00
lilia
d9fe783488 Accept close code/message via websocket/resources 2015-07-27 19:30:51 -07:00
lilia
8170a7baae WebSocketResource exposes socket.close()
Allows for simplification of the keepalive construct.
2015-07-27 18:51:48 -07:00
lilia
7d3d634a2d Move/refactor keepalive logic and add disconnect timer
We now disconnect ourselves if we don't get the server's response to a
keepalive request within 30s. This way we will eventually disconnect if
the network goes away but the socket is not closed.*

* See code.google.com/p/chromium/issues/detail?id=197841 and
https://stackoverflow.com/questions/11755605/chrome-websocket-connection-not-closed-when-browser-closed

We will then try to reconnect once a minute (See 8a10c96);

Keepalives belong at this level anyway, since the format is defined by
both the websocket resource protocol and our specific server url
structure.

// FREEBIE
2015-07-16 15:01:34 -07:00
Matt Corallo
8ad1a38b5b Move js files around for libtextsecure split 2015-01-14 09:35:57 -10:00
Renamed from js/websocket-resources.js (Browse further)