PrivMX DOCS
API Reference/PrivMX Endpoint Web/Events

EventApi

Class representing instance of Custom Events API

Methods

emitEvent

Emits the custom event on the given Context and channel.

Params

contextId

string

ID of the Context

channelName

string

name of the Channel

eventData

Uint8Array

event's data

users

UserWithPubKey[]

list of UserWithPubKey objects which defines the recipients of the event

emitEvent(contextId, channelName, eventData, users)

Returns

`` · undefined undefined

subscribeFor

Subscribe for the custom events on the given subscription query.

Params

subscriptionQueries

string[]

list of queries

subscribeFor(subscriptionQueries)

Returns

Promise<string[]> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

string[]

list of subscriptionId

unsubscribeFrom(subscriptionIds)

buildSubscriptionQuery

Generate subscription Query for the custom events.

Params

channelName

string

name of the Channel

selectorType

EventsEventSelectorType

scope on which you listen for events

selectorId

string

ID of the selector

buildSubscriptionQuery(channelName, selectorType, selectorId)

Returns

Promise<string> · undefined undefined

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.