Re: [EventSource] Question on event type

Thanks for the help.

So when you say "the name of the event", how in JavaScript do I access the
name of the event, e.g. to test it? Accessing  the data ( works,
but how do access the name?

In your example, is output but I don't see you accessing or using
the event name.


On Thu, Sep 8, 2011 at 10:46 AM, Glenn Maynard <> wrote:

> On Thu, Sep 8, 2011 at 1:16 PM, Bryan Sullivan <> 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 for an
> example.
> It would be good to have an example of this in the spec.
> > FYI, my test is at 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() ( does this at the PHP
> level; whether it works at the HTTP server level varies.
> --
> Glenn Maynard

Received on Thursday, 8 September 2011 17:57:14 UTC