EventHandler
public protocol EventHandler
Protocol for an object that will receive SSE events.
-
EventSource calls this method when the stream connection has been opened.
Declaration
Swift
func onOpened() -
EventSource calls this method when the stream connection has been closed.
Declaration
Swift
func onClosed() -
EventSource calls this method when it has received a new event from the stream.
Declaration
Swift
func onMessage(eventType: String, messageEvent: MessageEvent)Parameters
eventTypeThe type of the event.
messageEventThe data for the event.
-
EventSource calls this method when it has received a comment line from the stream.
Declaration
Swift
func onComment(comment: String)Parameters
commentThe comment received.
-
This method will be called for all exceptions that occur on the network connection (including an
UnsuccessfulResponseErrorif the server returns an unexpected HTTP status), but only after the ConnectionErrorHandler (if any) has processed it. If you need to do anything that affects the state of the connection, use ConnectionErrorHandler.Declaration
Swift
func onError(error: Error)Parameters
errorThe error received.
View on GitHub
EventHandler Protocol Reference