Skip to main content
reference

PMXEvent

Protocol for managing events within PrivMX Endpoint. Provides a standardized interface for handling and processing events with Swift Types.

Fields

connectionId

Unique identifier for the connection associated with this event. This property stores an `Int64` identifier that can be used to associate the event with a specific connection instance.

var connectionId: Int64

Static Methods

typeStr()

Provides a string that uniquely represents the type of the event. This method should return a specific string that identifies the event type, enabling consistent event categorization and processing.

static func typeStr() -> String

TypeDescription
String A `String` representing the type of the event.

Methods

handleWith(cb:)

Processes the event by executing a specified callback. This method allows for custom processing of event data, which is passed to the callback function. The `data` parameter contains information relevant to the event, though some events may lack associated data (hence, the optional `Any?` type).

func handleWith(cb: @escaping @Sendable (Any?) -> Void)

NameTypeDescription
cb@escaping @Sendable (<decl.var.parameter>Any?A closure that processes the event’s data. This callback accepts an optional `Any?` parameter representing the event’s data.

TypeDescription
Void

getChannel()

Retrieves the communication channel associated with this event. This method provides the name or identifier of the channel related to the event, which can be useful for directing or filtering event handling based on channel context.

func getChannel() -> String

TypeDescription
String A `String` representing the event’s associated channel.