@libp2p/floodsub
Version:
libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).
36 lines • 1.26 kB
TypeScript
import { TypedEventEmitter } from 'main-event';
import type { PubSubRPC } from './floodsub.ts';
import type { PeerStreamsEvents } from './index.ts';
import type { Stream, PeerId } from '@libp2p/interface';
import type { ProtobufStreamOpts } from '@libp2p/utils';
import type { DecoderOptions as LpDecoderOptions } from 'it-length-prefixed';
export interface PeerStreamInit {
peerId: PeerId;
stream: Stream;
}
export interface DecoderOptions extends LpDecoderOptions {
}
/**
* Thin wrapper around a peer's inbound / outbound pubsub streams
*/
export declare class PeerStreams extends TypedEventEmitter<PeerStreamsEvents> {
readonly peerId: PeerId;
/**
* An AbortController for controlled shutdown of the inbound stream
*/
private readonly shutDownController;
private inboundPb?;
private outboundPb?;
constructor(peerId: PeerId);
attachInboundStream(stream: Stream, streamOpts?: Partial<ProtobufStreamOpts>): void;
attachOutboundStream(stream: Stream, streamOpts?: Partial<ProtobufStreamOpts>): void;
/**
* Send a message to this peer
*/
write(message: PubSubRPC): void;
/**
* Closes the open connection to peer
*/
close(): void;
}
//# sourceMappingURL=peer-streams.d.ts.map