Skip to content

Documentation / @super-line/adapter-libp2p / createLibp2pAdapter

Function: createLibp2pAdapter()

createLibp2pAdapter(options?): Promise<Adapter & object>

Defined in: index.ts:134

Create a libp2p (gossipsub) Adapter for decentralized, broker-less multi-node fan-out. All channels ride one shared gossipsub topic; each node filters incoming messages by its local subscriptions, so subscribe / unsubscribe are local bookkeeping with no network round-trip. At-most-once delivery, matching the library's model.

Parameters

options?

Libp2pAdapterOptions = {}

Libp2pAdapterOptions (bring your own node, or let the adapter build one from listen / bootstrap).

Returns

Promise<Adapter & object>

Example

ts
const adapter = await createLibp2pAdapter({ bootstrap: ['/ip4/10.0.0.1/tcp/9001/p2p/12D3Koo...'] })
createSuperLineServer(api, { server, adapter })

Released under the MIT License.