Custom Events
Custom events allow emitting and receiving data of any shape in a secure, end-to-end encrypted way.
Custom events allow you to send information to specific groups of users. The data will not be stored anywhere. For an event to reach the recipient, the recipient must be subscribed to the channel on which you are emitting the event at that moment.
Before working with Custom Events, follow our Getting Started Guide.It will show you how to set up your project to work with PrivMX Bridge.
Sample code on this page is based on the initial assumptions.
Working with Custom Events
Key Considerations
Please note the following:
- Events will only trigger for active connections.
- Events are not captured unless explicitly listened for.
- A single instance of the
eventQueue
is shared across all connections.
Accessing Custom Event API
To access Custom Event methods, get the field eventApi
from active connection. Connection should be initialized with Modules.CUSTOM_EVENT
passed to PrivmxEndpoint()
.
Emitting and Handling Custom Events
Below you can find a simple code example showing how to emit an event with a custom payload and how to handle it when it arrives to the recipients.
Emitting Custom Event
Handling Custom Event
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.
PrivMX Endpoint Java v2.3