package js.html
extends EventTarget
Available on js
The EventSource interface is web content's interface to server-sent events. An EventSource instance opens a persistent connection to an HTTP server, which sends events in text/event-stream format.
Documentation EventSource by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
staticinlineread onlyCLOSED:Int = 2staticinlineread onlyCONNECTING:Int = 0staticinlineread onlyOPEN:Int = 1new(url:String, ?eventSourceInitDict:Null<EventSourceInit>)Throws:
null |
DOMError |
|---|
onerror:FunctionIs an EventHandler called when an error occurs and the error event is dispatched on an EventSource object.
onmessage:FunctionIs an EventHandler called when a message event is received, that is when a message is coming from the source.
onopen:FunctionIs an EventHandler called when an open event is received, that is when the connection was just opened.
read onlyreadyState:IntA number representing the state of the connection. Possible values are CONNECTING (0), OPEN (1), or CLOSED (2).
read onlyurl:StringA DOMString representing the URL of the source.
read onlywithCredentials:BoolA Boolean indicating whether the EventSource object was instantiated with cross-origin (CORS) credentials set (true), or not (false, the default).
close():VoidCloses the connection, if any, and sets the readyState attribute to CLOSED. If the connection is already closed, the method does nothing.
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/EventSource.html