PrivMX DOCS
API Reference/PrivMX Endpoint Swift Extra/Events

EventApi

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

Methods

emitEvent(in:to:on:containing:)

Emits a new Custom Event

Params

contextId

String

id of the Context in which the Event will be emited

users

[privmx.endpoint.core.UserWithPubKey]

users that will receive the Event

channelName

String

channel name on which the event will be emitted

eventData

Data

arbitrary payload of the Event

func emitEvent(
in contextId: String,
to users: [privmx.endpoint.core.UserWithPubKey],
on channelName: String,
containing eventData: Data
) throws -> Void

subscribeFor(_:)

Subscribe for the events on the given subscription queries. Use the buildSubscriptionQuery(channelName:selectorType:selectorId:) method to generate properly formatted subscription query.

Params

subscriptionQueries

[String]

list of queries

func subscribeFor(
_ subscriptionQueries: [String]
) throws -> [String]

Returns

[String] · list of subscriptionIds in maching order to subscriptionQueries.

unsubscribeFrom(_:)

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

[String]

list of subscriptionId

func unsubscribeFrom(
_ subscriptionIds: [String]
) throws -> Void

buildSubscriptionQuery(forChannel:selectorType:selectorId:)

Generate subscription Query for the Custom events.

Params

channelName

String

name of the Custom event channel

selectorType

privmx.endpoint.event.EventSelectorType

scope on which you listen for events

selectorId

String

ID of the selector

func buildSubscriptionQuery(
forChannel channelName: String,
selectorType: privmx.endpoint.event.EventSelectorType,
selectorId: String
) throws -> String

Returns

String · a properly formatted event subscription request.

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

EventApi | PrivMX Docs