class js.html.EventSource extends EventTarget

Available on js

The EventSource interface is used to manage server-sent events. You can set the onmessage attribute to a JavaScript function to receive non-typed messages (that is, messages with no event field). You can also call addEventListener() to listen for events just like any other event source.

See Using server-sent events for further details.



Documentation for this class was provided by MDN.

Class Fields

static var CLOSED:Int

The connection is not being established, has been closed or there was a fatal error.

static var CONNECTING:Int

The connection is being established.

static var OPEN:Int

The connection is open and dispatching events.

Instance Fields

var onerror:EventListener

A JavaScript function to call when an error occurs.

var onmessage:EventListener

A JavaScript function to call when an a message without an event field arrives.

var onopen:EventListener

A JavaScript function to call when the connection has opened.

var readyState:Int

The state of the connection, must be one of CONNECTING, OPEN, or CLOSED. Read only.

var url:String

Read only.

function new(scriptUrl:String):Void

function close():Void