W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

Re: [Server-Sent Events] Network connection clarification

From: Odin Hørthe Omdal <odinho@opera.com>
Date: Tue, 17 Jul 2012 17:46:47 +0200
To: public-webapps@w3.org
Message-ID: <op.whlkr9n149xobu@odinho-fido.oslo.osa>
On Wed, 11 Jul 2012 00:52:06 +0200, Ian Hickson <ian@hixie.ch> wrote:
> Exponential back-off isn't at all necessarily the right solution. In
> particular, consider mobile devices, where network connectivity goes in
> and out as the user moves. Most of the time, you want to be trying to
> connect as soon as you have connectivity. Similarly with laptops on wifi
> where the connection is only briefly hurt by an obstacle -- you want to
> keep trying every few seconds until the obstacle is gone. Exponential
> backoff if a terrible thing in those kinds of situations.
> You can distinguish local network difficulties from server load
> difficulties in a variety of ways, e.g. having a dedicated ping server on
> the same network as the "real" server, which doesn't suffer from the same
> load concerns, and which you try to contact and only switch to  
> exponential
> backoff if it responds but the main server isn't. And so on. UAs can do
> that kind of thing.

Exactly. I'm a bit unsure about why you wrote this which is a support for  
the "let the UA do the reconnecting because it is smart" case, but still  
is hesitant about changing the spec to follow implementations there.

>> SSE is mostly a convenience API (advanced authors can use streaming XHR
>> or WebSockets to achieve the same result the hard way), so lack of
>> convenience in error recovery feels like an omission in this API.
> If it's something we do want to eventually support, I think it's be
> something to consider for v2.

I think we should fix this now. As said, for Opera's part I think we can  
follow spec (we're the closest to it now anyway :P) but I actually like  
the «UA handles reconnects» case better. However, it should really have  
some sort of state and event notifying about what it is doing.

So if you are prone to DoS-ing, and don't trust the user agent's  
implementation, you can actually do:

     es.onreconnecting = function(e) {
         // es.readyState is EventSource.RECONNECTING

         // We don't want the default behaviour

I agree with Chaals and Kornel Lesiński, and actually most of the posters  
on this topic. I don't we're far from a good solution.

The core issue is, at least as I see it, is that implementations differ  
pretty starkly from what the spec says - so something has to change  
somewhere :-)

Odin Hørthe Omdal (Velmont/odinho) · Core, Opera Software, http://opera.com
Received on Tuesday, 17 July 2012 14:46:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:37 UTC