Skip to main content
reference

EventQueue

Swift wrapper for privmx.NativeEventQueueWrapper, providing functionality to interact with the event queue within PrivMX platform.

Static Methods

getInstance()

Retrieves a singleton instance of `EventQueue`. This method attempts to access the global instance of `EventQueue`, ensuring only one instance of the event queue wrapper exists. It should be used whenever event queue interaction is needed.

public static func getInstance(
) throws -> EventQueue

TypeDescription
EventQueue The singleton `EventQueue` instance.

Methods

emitBreakEvent()

Inserts a special break event into the event queue. This method emits a special event, `privmx.endpoint.core.libBreakEvent`, into the event queue. This break event can be used to interrupt or signal specific conditions in the event processing flow.

public func emitBreakEvent(
) throws -> Void

waitEvent()

Waits for the next event in the queue. This method will pause and wait until a new event arrives in the queue. If there are any unprocessed events already in the queue, it will return the first unprocessed event. The returned event should be queried using `is*Event` methods and extracted with the appropriate method.

public func waitEvent(
) throws -> privmx.endpoint.core.EventHolder

TypeDescription
privmx.endpoint.core.EventHolder An `EventHolder` object containing the next available event.

getEvent()

Attempts to retrieve the next unprocessed event from the queue. This method retrieves the next unprocessed event from the queue without waiting. If there are no unprocessed events, it will simply return `nil`. The returned event, if present, should be queried using `is*Event` methods and extracted with the appropriate method.

public func getEvent(
) throws -> privmx.endpoint.core.EventHolder?

TypeDescription
privmx.endpoint.core.EventHolder? An `EventHolder` containing the next unprocessed event, or `nil` if no unprocessed events are available.