Buffered connection event emitter modeled after Baileys' makeEventBuffer.
Summary
Functions
Signals the emitter to enter buffering mode.
Returns whether the event emitter is currently in buffering mode.
Returns a specification to start this module under a supervisor.
Wraps a function execution in an active event buffer context.
Emit a specific event. Will buffer the event if buffering is currently active.
Manually flushes the buffer if active. Returns true if a flush occurred.
Registers a process handler function for events. Returns an unsubscription function.
Provides seed values used during conditional event flush evaluation.
Starts the EventEmitter.
Registers a tap handler function that processes events before the main dispatch. Returns an unsubscription function.
Types
@type event() ::
:blocklist_set
| :blocklist_update
| :call
| :chats_delete
| :chats_lock
| :chats_update
| :chats_upsert
| :connection_update
| :contacts_update
| :contacts_upsert
| :creds_update
| :dirty_update
| :group_join_request
| :group_member_tag_update
| :group_participants_update
| :groups_update
| :groups_upsert
| :labels_association
| :labels_edit
| :lid_mapping_update
| :message_receipt_update
| :messages_delete
| :messages_media_update
| :messages_reaction
| :messages_update
| :messages_upsert
| :messaging_history_set
| :newsletter_participants_update
| :newsletter_reaction
| :newsletter_settings_update
| :newsletter_view
| :presence_update
| :socket_node
| :settings_update
Functions
@spec buffer(GenServer.server()) :: :ok
Signals the emitter to enter buffering mode.
@spec buffering?(GenServer.server()) :: boolean()
Returns whether the event emitter is currently in buffering mode.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec create_buffered_function(GenServer.server(), (-> term())) :: (-> term())
Wraps a function execution in an active event buffer context.
@spec emit(GenServer.server(), event(), term()) :: :ok
Emit a specific event. Will buffer the event if buffering is currently active.
@spec flush(GenServer.server()) :: boolean()
Manually flushes the buffer if active. Returns true if a flush occurred.
@spec process(GenServer.server(), (map() -> term())) :: (-> :ok)
Registers a process handler function for events. Returns an unsubscription function.
@spec seed(GenServer.server(), map()) :: :ok
Provides seed values used during conditional event flush evaluation.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the EventEmitter.
@spec tap(GenServer.server(), (map() -> term())) :: (-> :ok)
Registers a tap handler function that processes events before the main dispatch. Returns an unsubscription function.