Class: CEventSource

codemelted.CEventSource(url, withCredentials, onMessage)

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. The connection remains open until closed.

Constructor

new CEventSource(url, withCredentials, onMessage)

Constructor for the class.
Parameters:
Name Type Description
url string The url to the server streaming the events.
withCredentials boolean True if using CORS, false otherwise.
onMessage COnMessageListener The callback for received messages.
Source:

Members

(static, readonly) CLOSED :number

Identifies an closed state for the object.
Type:
  • number
Source:

(static, readonly) CONNECTING :number

Identifies an connecting state for the object.
Type:
  • number
Source:

(static, readonly) OPEN :number

Identifies an open state for the object.
Type:
  • number
Source:

(readonly) state :number

Determines the current state of the object. Once in a CLOSED state you will need to get a new object.
Type:
  • number
Source:

Methods

close()

Closes the server sent event receiver.
Source: