@objcMembers
open class PusherChannel : NSObject
Undocumented
Undocumented
DeclarationSwift
open var eventHandlers: [String : [EventHandler]] { get set }
Undocumented
DeclarationSwift
public var subscriptionCount: Int? { get }
Undocumented
DeclarationSwift
open var subscribed: Bool
Undocumented
DeclarationSwift
public let name: String
Undocumented
DeclarationSwift
open var onSubscriptionCountChanged: ((Int) -> Void)?
Initializes a new PusherChannel with a given name and connection
DeclarationSwift
public init(name: String, connection: PusherConnection, auth: PusherAuth? = nil, onSubscriptionCountChanged: ((Int) -> Void)? = nil)
Parameters name
The name of the channel
connection
The connection that this channel is relevant to
auth
A PusherAuth value if subscription is being made to an authenticated channel without using the default auth methods
Return ValueA new PusherChannel instance
Binds a callback to a given event name, scoped to the PusherChannel the function is called on
DeclarationSwift
@discardableResult
open func bind(eventName: String, eventCallback: @escaping (PusherEvent) -> Void) -> String
Parameters eventName
The name of the event to bind to
eventCallback
The function to call when a new event is received. The callback receives a PusherEvent, containing the event’s data payload and other properties.
Return ValueA unique callbackId that can be used to unbind the callback at a later time
Unbinds the callback with the given callbackId from the given eventName, in the scope of the channel being acted upon
DeclarationSwift
open func unbind(eventName: String, callbackId: String)
Parameters eventName
The name of the event from which to unbind
callbackId
The unique callbackId string used to identify which callback to unbind
Unbinds all callbacks from the channel
DeclarationSwift
open func unbindAll()
Unbinds all callbacks for the given eventName from the channel
DeclarationSwift
open func unbindAll(forEventName eventName: String)
Parameters eventName
The name of the event from which to unbind
Calls the appropriate callbacks for the given eventName in the scope of the acted upon channel
Parameters event
The event received from the websocket
If subscribed, immediately call the connection to trigger a client event with the given eventName and data, otherwise queue it up to be triggered upon successful subscription
DeclarationSwift
open func trigger(eventName: String, data: Any)
Parameters eventName
The name of the event to trigger
data
The data to be sent as the message payload
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4