Notification
final class Notification
Class that provides
-
Connects to a websocket and subscribes for
InPlayerNotification
s.Declaration
Swift
public static func subscribe(onStatusChanged: @escaping (_ status: InPlayerNotificationStatus) -> Void, onMessageReceived: @escaping (_ notification: InPlayerNotification) -> Void, onError: @escaping (_ error: InPlayerError) -> Void)
Parameters
onStatusChanged
A closure to be executed everytime when connection status change occurs.
status
InPlayerNotificationStatus
enum that shows current connection statusonMessageReceived
A closure to be executed everytime new notification is sent from the server.
notification
InPlayerNotification
struct optionally containing associated values depending on the type enum.onError
A closure to be executed when some error occurred.
error
InPlayerError
containing info about the error that occurred. -
Disconnects from websocket and stop receving
InPlayerNotification
.Declaration
Swift
public static func unsubscribe()
-
Returns subscribed status
Declaration
Swift
public static func isSubscribed() -> Bool