PrivmxEndpoint
Extends BasicPrivmxEndpoint with event callbacks dispatcher.
Constructors
PrivmxEndpoint
Calls BasicPrivmxEndpoint#BasicPrivmxEndpoint(Set, String, String, String).
public void PrivmxEndpoint(
Set<Modules> enableModule,
String userPrivateKey,
String solutionId,
String bridgeUrl
)
Name | Type | Description |
---|---|---|
enableModule | Set<Modules> | set of modules to initialize; should contain Modules#THREAD to enable Thread module or Modules#STORE to enable Store module |
userPrivateKey | String | user private key used to authorize; generated from: CryptoApi#generatePrivateKey or CryptoApi#derivePrivateKey |
solutionId | String | `SolutionId` of the current project |
bridgeUrl | String | Bridge's Endpoint URL |
Methods
handleEvent
Handles event and invokes all related callbacks. It should only be called by event loops.
public void handleEvent(
Event<?> event
)
Name | Type | Description |
---|---|---|
event | Event<?> | event to handle |
registerCallback
Registers callbacks with the specified type.
public final <T> void registerCallback(
Object context,
EventType<T> eventType,
EventCallback<T> callback
)
Name | Type | Description |
---|---|---|
context | Object | an object that identifies callbacks in the list |
eventType | EventType<T> | type of event to listen to |
callback | EventCallback<T> | a block of code to execute when event was handled |
unregisterAll
Unregisters all callbacks registered by #registerCallback(Object, EventType, EventCallback).
public void unregisterAll()
unregisterCallbacks
Unregisters all callbacks registered by #registerCallback(Object, EventType, EventCallback) and identified with given Context.
public void unregisterCallbacks(
Object context
)
Name | Type | Description |
---|---|---|
context | Object | an object that identifies callbacks in the list. |