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

Re: [EventSource] Question on event type

From: Glenn Maynard <glenn@zewt.org>
Date: Thu, 8 Sep 2011 13:46:33 -0400
Message-ID: <CABirCh9kWvPXyiYoA4P74whOGaapx=xGRQ2=YLiTs6V4+2ahPw@mail.gmail.com>
To: Bryan Sullivan <blsaws@gmail.com>
Cc: public-webapps@w3.org
On Thu, Sep 8, 2011 at 1:16 PM, Bryan Sullivan <blsaws@gmail.com> wrote:
> The event type for the MessageEvent is "message" (in all browsers I have
tested, and there is no other "type" attribute defined for MessageEvent. So
if I send from my server a line "event: foo\n", I would expect from reading
above that the event attribute "type" is set to "foo". What am I missing?

Note that "event type" with DOM Events terms really means the name of the
event.  Changing it doesn't change the type in the sense of giving it a
different interface; it's just a different label that you can listen for
with addEventListener.

This allows listening to different remote message types with different event
handlers.  See https://zewt.org/~glenn/event-source.html for an example.

It would be good to have an example of this in the spec.

> FYI, my test is at http://test.bkaj.net/webapi/server-sent-events/. I have
yet to figure out how to get PHP (or the underlying Apache server) to not
buffer output, so I send enough data to fill the buffer - a bad kludge but
it makes the test work (I think). Any help there is also appreciated.

flush() (http://php.net/manual/en/function.flush.php) does this at the PHP
level; whether it works at the HTTP server level varies.

Glenn Maynard
Received on Thursday, 8 September 2011 17:47:01 UTC

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