Notification
final class Notification
Class that provides
-
Connects to a websocket and subscribes for
InPlayerNotifications.Declaration
Swift
public static func subscribe(onStatusChanged: @escaping (_ status: InPlayerNotificationStatus) -> Void, onMessageReceived: @escaping (_ notification: InPlayerNotification) -> Void, onError: @escaping (_ error: InPlayerError) -> Void)Parameters
onStatusChangedA closure to be executed everytime when connection status change occurs.
statusInPlayerNotificationStatusenum that shows current connection statusonMessageReceivedA closure to be executed everytime new notification is sent from the server.
notificationInPlayerNotificationstruct optionally containing associated values depending on the type enum.onErrorA closure to be executed when some error occurred.
errorInPlayerErrorcontaining 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
View on GitHub
Notification Class Reference