JavaScripture
Contribute via GitHub Feedback

EventSource : EventTarget

EventSource allows listening to events pushed from the server. Similar to a WebSocket except it is a one way connection.

Constructors

new EventSource(url : String, [init : Object]) : EventSource
init : {
withCredentials :Boolean
}

Creates an EventSource.

Example:

Run

Results:

 

Instance Properties

readyState : Number  

The current connection state. Will be one of CONNECTING, OPEN, or CLOSED.

Example:

Run

Results:

 

url : String  

The url this is connected to.

Example:

Run

Results:

 

Instance Methods

close() : undefined

Instance Events

onerror / 'error'  
listener(event : ErrorEvent) : undefined
onmessage / 'message'  
listener(event : MessageEvent) : undefined
onopen / 'open'  
listener(event : Event) : undefined

EventSource Properties

CLOSED : Number  
CONNECTING : Number  
OPEN : Number