PrivMX DOCS
API Reference/PrivMX Endpoint Swift/Events

EventApi

‘EventApi’ is a class representing Endpoint’s API for context custom events.

Static Methods

create(connection:)

Creates an instance of ‘EventApi’.

Params

connection

inout Connection

instance of ‘Connection’

public static func create(
connection: inout Connection
) throws -> EventApi

Returns

EventApi · EventApi object

Methods

emitEvent(contextId:users:channelName:eventData:)

Emits the custom event on the given Context and channel.

Params

contextId

std.string

ID of the Context

users

privmx.UserWithPubKeyVector

event’s data

channelName

std.string

list of UserWithPubKey objects which defines the recipients of the event

eventData

privmx.endpoint.core.Buffer

name of the Channel

public func emitEvent(
contextId: std.string,
users: privmx.UserWithPubKeyVector,
channelName: std.string,
eventData: privmx.endpoint.core.Buffer,
) throws -> Void

subscribeFor(subscriptionQueries:)

Subscribe for the custom events on the given subscription query.

Params

subscriptionQueries

privmx.SubscriptionQueryVector

list of queries

public func subscribeFor(
subscriptionQueries: privmx.SubscriptionQueryVector
) throws -> privmx.SubscriptionIdVector

Returns

privmx.SubscriptionIdVector · list of subscriptionIds in maching order to subscriptionQueries.

unsubscribeFrom(subscriptionIds:)

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

privmx.SubscriptionIdVector

list of subscriptionId

public func unsubscribeFrom(
subscriptionIds: privmx.SubscriptionIdVector
) throws -> Void

buildSubscriptionQuery(channelName:selectorType:selectorId:)

Generate subscription Query for the Custom events.

Params

channelName

std.string

name of the Channel

selectorType

privmx.endpoint.event.EventSelectorType

selector of scope on which you listen for events

selectorId

std.string

ID of the selector

public func buildSubscriptionQuery(
channelName: std.string,
selectorType: privmx.endpoint.event.EventSelectorType,
selectorId: std.string
) throws -> privmx.SubscriptionQuery

Returns

privmx.SubscriptionQuery ·

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.