EventSource

open class EventSource(val url: String, init: EventSourceInit = definedExternally) : EventTarget(source)

The EventSource interface is web content's interface to server-sent events.

MDN Reference

Constructors

Link copied to clipboard
constructor(url: URL, init: EventSourceInit = definedExternally)
constructor(url: String, init: EventSourceInit = definedExternally)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface ReadyState

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The readyState read-only property of the EventSource interface returns a number representing the state of the connection.

Link copied to clipboard
val url: String

The url read-only property of the EventSource interface returns a string representing the URL of the source.

Link copied to clipboard

The withCredentials read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.

Functions

Link copied to clipboard
fun close()

The close() method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).

Link copied to clipboard
Link copied to clipboard