[whatwg] Clarification request on Server-Sent Events Last-Event-ID

Anne van Kesteren annevk at opera.com
Thu Nov 25 08:31:55 PST 2010


On Fri, 12 Nov 2010 23:53:51 +0100, Nicholas Zakas <nzakas at yahoo-inc.com>  
wrote:
> Just a quick question about the Last-Event-ID header. The spec currently  
> says:
>
>>> If the event source's last event ID string is not the empty string,  
>>> then a Last-Event-ID HTTP header must be included with the request,  
>>> whose value is the value of the event source's last event ID string,  
>>> encoded as UTF-8.
>
> Consider the following scenario: a connection is established and one of  
> the events has an id of "foo", so the last event ID of the event source  
> is now "foo". The connection drops and on reconnect, the header  
> Last-Event-ID: foo is sent per the spec. The next stream of events  
> coming through do not have any IDs. The connection is dropped again.
>
> The question is whether or not Last-Event-ID: foo should be sent a  
> second time? Technically, it is the last event ID of the event source,  
> and the spec never mentions resetting the last event ID outside of an  
> empty "id" field in the stream.

WebKit and Opera both match the specification here. I have added a  
testcase for this behavior:

http://tc.labs.opera.com/apis/EventSource/format-field-id-2.htm

You can get the source code for the tests here:

http://tc.labs.opera.com/svn

If you want to contribute more tests following this style. Let me know!


-- 
Anne van Kesteren
http://annevankesteren.nl/



More information about the whatwg mailing list