EventSource
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:
Static variables
staticinlineread onlyCLOSED:Int = 2
staticinlineread onlyCONNECTING:Int = 0
staticinlineread onlyOPEN:Int = 1
Constructor
new(url:String, ?eventSourceInitDict:Null<EventSourceInit>)
Throws:
null |
DOMError |
|---|
Variables
onerror:Function
Is an EventHandler called when an error occurs and the error event is dispatched on an EventSource object.
onmessage:Function
Is an EventHandler called when a message event is received, that is when a message is coming from the source.
onopen:Function
Is an EventHandler called when an open event is received, that is when the connection was just opened.
read onlyreadyState:Int
A number representing the state of the connection. Possible values are CONNECTING (0), OPEN (1), or CLOSED (2).
read onlyurl:String
A DOMString representing the URL of the source.
read onlywithCredentials:Bool
A Boolean indicating whether the EventSource object was instantiated with cross-origin (CORS) credentials set (true), or not (false, the default).
Methods
close():Void
Closes 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