EventSource
public class EventSource
Provides an EventSource client for consuming Server-Sent Events.
See the Server-Sent Events spec for more details.
-
Initialize the
EventSourceclient with the given configuration.Declaration
Swift
public init(config: Config)Parameters
configThe configuration for initializing the
EventSourceclient. -
Start the
EventSourceclient.This will initiate a streaming connection to the configured URL. The application will be informed of received events and state changes using the configured
EventHandler.Declaration
Swift
public func start() -
Shuts down the
EventSourceclient. It is not valid to restart the client after calling this function.Declaration
Swift
public func stop() -
Get the most recently received event ID, or the value of
EventSource.Config.lastEventIdif no event IDs have been received.Declaration
Swift
public func getLastEventId() -> String? -
Struct for configuring the EventSource.
See moreDeclaration
Swift
public struct Config
View on GitHub
EventSource Class Reference