Event
public struct Event : EventInfoRecord, Encodable
An event to trigger on a specific Channel (or multiple channels).
-
The channels to which the event will be sent (if publishing to multiple channels).
Declaration
Swift
public let channels: [Channel]? -
The channel to which the event will be sent (if publishing to a single channel).
Declaration
Swift
public let channel: Channel? -
The event name.
Declaration
Swift
public let name: String -
This is the
Datarepresentation of the originaldataparameter of either of theinit(...)methods. The data will be encrypted if achannelis set and itsChannelTypeisencrypted.Declaration
Swift
public let data: Data -
A connection to which the event will not be sent.
Declaration
Swift
public let socketId: String?
-
Creates an event to be triggered on a specific
Channel.Declaration
Swift
public init<EventData: Encodable>(name: String, data: EventData, channel: Channel, socketId: String? = nil, attributeOptions: ChannelAttributeFetchOptions = []) throwsParameters
nameThe name of the event.
dataAn event data object, whose type must conform to
Encodable.channelThe channel on which to trigger the event.
socketIdA connection to which the event will not be sent.
attributeOptionsA set of attributes that should be returned for the
channel. -
Creates an
Eventwhich will be triggered on multipleChannelinstances.Throws
AnPusherErrorif encoding the eventdatafails for some reason, or ifchannelscontains any encrypted channels.Declaration
Swift
public init<EventData: Encodable>(name: String, data: EventData, channels: [Channel], socketId: String? = nil, attributeOptions: ChannelAttributeFetchOptions = []) throwsParameters
nameThe name of the event.
dataAn event data object, whose type must conform to
Encodable.channelsAn array of channels on which to trigger the event.
socketIdA connection to which the event will not be sent.
attributeOptionsA set of attributes that should be returned for each channel in
channels.
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
View on GitHub
Event Structure Reference