PrivMX DOCS
Java

Handling Events

How to subscribe to events, assuming you have already started listening.

Connection

val callbacksId = "CALLBACKS_ID"
 
endpointSession.registerCallback(
    callbacksId,
    EventType.ConnectedEvent
){
    // some actions when lib was connected
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.DisconnectedEvent
){
    // some actions when lib was disconnected
}

Threads

val callbacksId = "CALLBACKS_ID"
 
endpointSession.registerCallback(
    callbacksId,
    EventType.ThreadCreatedEvent
){ newThreadData ->
    // some actions when new thread created
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.ThreadUpdatedEvent
){ threadUpdateData ->
    // some actions when thread updated
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.ThreadStatsChangedEvent
){ threadStatsUpdateData ->
    // some actions when thread stats changed
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.ThreadDeletedEvent
){ deletedThreadData ->
    // some actions when thread deleted
}

Read more about Thread events.

Stores

val callbacksId = "CALLBACKS_ID"
 
endpointSession.registerCallback(
    callbacksId,
    EventType.StoreCreatedEvent
){ newStoreData ->
    // some actions when new store created
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.StoreUpdatedEvent
){ storeUpdateData ->
    // some actions when store updated
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.StoreStatsChangedEvent
){ storeStatsUpdateData ->
    // some actions when store stats changed
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.StoreDeletedEvent
){ deletedStoreData ->
    // some actions when store deleted
}

Read more about Store events.

Inboxes

val callbacksId = "CALLBACKS_ID"
 
endpointSession.registerCallback(
    callbacksId,
    EventType.InboxCreatedEvent
){ newInboxData ->
    // some actions when new inbox created
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.InboxUpdatedEvent
){ inboxUpdateData ->
    // some actions when inbox updated
}
 
endpointSession.registerCallback(
    callbacksId,
    EventType.InboxDeletedEvent
){ deletedInboxData ->
    // some actions when inbox deleted
}

Read more about Inbox events.

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.

On this page