PrivMX DOCS
API Reference/Endpoint/Event

EventApi

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

Constructors

EventApi

EventApi()

Static Methods

create

Creates an instance of 'EventApi'.

Params

connection

core::Connection &

instance of 'Connection'

static EventApi create(
core::Connection &connection
)

Returns

EventApi · EventApi object

Methods

emitEvent

Emits the custom event on the given Context and channel.

Params

contextId

const std::string &

ID of the Context

users

const std::vector<core::UserWithPubKey> &

list of UserWithPubKey objects which defines the recipients of the event

channelName

const std::string &

name of the Channel

eventData

const core::Buffer &

event's data

void emitEvent(
const std::string &contextId
const std::vector<core::UserWithPubKey> &users
const std::string &channelName
const core::Buffer &eventData
)

subscribeFor

Subscribe for the custom events on the given subscription query.

Params

subscriptionQueries

const std::vector<std::string> &

list of queries

std::vector< std::string > subscribeFor(
const std::vector<std::string> &subscriptionQueries
)

Returns

std::vector<std::string> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

const std::vector<std::string> &

list of subscriptionId

void unsubscribeFrom(
const std::vector<std::string> &subscriptionIds
)

buildSubscriptionQuery

Generate subscription Query for the custom events.

Params

channelName

const std::string &

name of the Channel

selectorType

EventSelectorType

selector of scope on which you listen for events

selectorId

const std::string &

ID of the selector

std::string buildSubscriptionQuery(
const std::string &channelName
EventSelectorType selectorType
const std::string &selectorId
)

Returns

std::string ·

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.