Open Bug 780396 Opened 12 years ago Updated 2 years ago

EventSource doesn't fire 'open' events until some data is received

Categories

(Core :: DOM: Core & HTML, defect, P5)

22 Branch
x86_64
Linux
defect

Tracking

()

People

(Reporter: luca.wehrstedt, Unassigned)

Details

Attachments

(2 files)

It seems to me that EventSource doesn't fire 'open' events when the connection is opened. Instead, it fires them as soon as some data is received from the server. I'm using these events to update a "connection status indicator" and I'd like to show that the connection has been correctly established even if no events have been received yet.

I'm attaching a demo that clearly shows this behavior. It includes a HTML page and a sample server written in Python, using Tornado, that allows you to easily tweak what is sent on the event stream. Just put them both in the same directory and start the Python script.

You'll notice that, when the demo starts, nothing is printed on the Firebug console. You can also check that es.readyState is 0 (i.e. CONNECTING). Yet, when a message is received, it'll preceded by the open event, and the state will also be correctly set. The same happens also if the server sends a 'retry' command or just a comment.

Other browser (like Chromium) send the open event as soon as the connection is established. I think their behavior is the "correct" one.
Attached file demo HTML page
Attached file demo Python server
Attachment #649008 - Attachment mime type: text/plain → text/html
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
Product: Firefox → Core
Version: 14 Branch → 22 Branch
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: