Pusher
@objcMembers
@objc
open class Pusher : NSObject
Undocumented
-
Undocumented
Declaration
Swift
public let connection: PusherConnection -
Undocumented
Declaration
Swift
open weak var delegate: PusherDelegate? { get set } -
Initializes the Pusher client with an app key and any appropriate options.
Declaration
Swift
public init(key: String, options: PusherClientOptions = PusherClientOptions())Parameters
keyThe Pusher app key
optionsAn optional collection of options
Return Value
A new Pusher client instance
-
Subscribes the client to a new channel
Declaration
Swift
open func subscribe( _ channelName: String, auth: PusherAuth? = nil, onMemberAdded: ((PusherPresenceChannelMember) -> Void)? = nil, onMemberRemoved: ((PusherPresenceChannelMember) -> Void)? = nil, onSubscriptionCountChanged: ((Int) -> Void)? = nil ) -> PusherChannelParameters
channelNameThe name of the channel to subscribe to
authA PusherAuth value if subscription is being made to an authenticated channel without using the default auth methods
onMemberAddedA function that will be called with information about the member who has just joined the presence channel
onMemberRemovedA function that will be called with information about the member who has just left the presence channel
Return Value
A new PusherChannel instance
-
subscribeToPresenceChannel(channelName:auth: onMemberAdded: onMemberRemoved: onSubscriptionCountChanged: ) Subscribes the client to a new presence channel. Use this instead of the subscribe function when you want a presence channel object to be returned instead of just a generic channel object (which you can then cast)
Declaration
Swift
open func subscribeToPresenceChannel( channelName: String, auth: PusherAuth? = nil, onMemberAdded: ((PusherPresenceChannelMember) -> Void)? = nil, onMemberRemoved: ((PusherPresenceChannelMember) -> Void)? = nil, onSubscriptionCountChanged: ((Int) -> Void)? = nil ) -> PusherPresenceChannelParameters
channelNameThe name of the channel to subscribe to
authA PusherAuth value if subscription is being made to an authenticated channel without using the default auth methods
onMemberAddedA function that will be called with information about the member who has just joined the presence channel
onMemberRemovedA function that will be called with information about the member who has just left the presence channel
Return Value
A new PusherPresenceChannel instance
-
Unsubscribes the client from a given channel
Declaration
Swift
open func unsubscribe(_ channelName: String)Parameters
channelNameThe name of the channel to unsubscribe from
-
Unsubscribes the client from all channels
Declaration
Swift
open func unsubscribeAll() -
Binds the client’s global channel to all events
Declaration
Swift
@discardableResult open func bind(eventCallback: @escaping (PusherEvent) -> Void) -> StringParameters
eventCallbackThe function to call when a new event is received. The callback receives a PusherEvent, containing the event’s data payload and other properties.
Return Value
A unique string that can be used to unbind the callback from the client
-
Unbinds the client from its global channel
Declaration
Swift
open func unbind(callbackId: String)Parameters
callbackIdThe unique callbackId string used to identify which callback to unbind
-
Unbinds the client from all global callbacks
Declaration
Swift
open func unbindAll() -
Disconnects the client’s connection
Declaration
Swift
open func disconnect() -
Initiates a connection attempt using the client’s existing connection details
Declaration
Swift
open func connect() -
Undocumented
Declaration
Swift
func subscribe(channelName: String) -> PusherChannel -
Undocumented
Declaration
Swift
func subscribe( channelName: String, onMemberAdded: ((PusherPresenceChannelMember) -> Void)? = nil, onMemberRemoved: ((PusherPresenceChannelMember) -> Void)? = nil, onSubscriptionCountChanged: ((Int) -> Void)? = nil ) -> PusherChannel -
Undocumented
Declaration
Swift
func subscribeToPresenceChannel(channelName: String) -> PusherPresenceChannel -
Undocumented
Declaration
Swift
func subscribeToPresenceChannel( channelName: String, onMemberAdded: ((PusherPresenceChannelMember) -> Void)? = nil, onMemberRemoved: ((PusherPresenceChannelMember) -> Void)? = nil, onSubscriptionCountChanged: ((Int) -> Void)? = nil ) -> PusherPresenceChannel -
Undocumented
Declaration
Swift
convenience init(withAppKey key: String, options: PusherClientOptions) -
Undocumented
Declaration
Swift
convenience init(withKey key: String)
View on GitHub
Pusher Class Reference