Skip to content

@nhtio/p2pbus

A TypeScript library for creating a peer-to-peer event bus

Classes

ClassDescription
LoggerAn event emitter for which emits Pino-compatible logging events.
P2PBusP2PBus class is an event emitter which utilizes the libp2p library to publish and subscribe to events over a peer-to-peer network. It is designed to be used in a decentralized environment where there is no central server to handle events.

Interfaces

InterfaceDescription
EventCallbacksThe augmentable interface which describes the possible events and the shape of the event callbacks.
LoggerEventCallbacksA map of event names to their corresponding callback functions for the Logger class.
LogMethodWithAnyTypedMergingObjectAn interface represending one of the possible signatures of a logging method in the LogMethod union
LogMethodWithMergingObjectAn interface represending one of the possible signatures of a logging method in the LogMethod union
LogMethodWithoutMergingObjectAn interface represending one of the possible signatures of a logging method in the LogMethod union
LogMethodWithUnknownMergingObjectAn interface represending one of the possible signatures of a logging method in the LogMethod union

Type Aliases

Type AliasDescription
EventEmitterEventMapThe map of events defined in EventCallbacks which emitted by P2PBus.
LoggerEventEmitterEventMapA utility type to extract the event names and their corresponding arguments from the LoggerEventCallbacks interface for use with the Logger class.
LogMethodRepresents a pino-compatible logging method used by the events in the LoggerEventCallbacks, which can have different signatures such as: - LogMethodWithMergingObject - LogMethodWithUnknownMergingObject - LogMethodWithoutMergingObject - LogMethodWithAnyTypedMergingObject

Variables

VariableDescription
versionThe current version of the package.

References

EventCallbackResult

Re-exports EventCallbackResult


EventName

Re-exports EventName