@libp2p/webrtc-peer
Version:
Simple one-to-one WebRTC data channels
20 lines • 632 B
TypeScript
import type { Logger } from '@libp2p/logger';
export interface WebRTCDataChannelOptions {
onMessage: (event: MessageEvent<Uint8Array>) => void;
onOpen: () => void;
onClose: () => void;
onError: (err: Error) => void;
log: Logger;
}
export declare class WebRTCDataChannel {
label: string;
private readonly channel;
private readonly closingInterval;
private open;
private readonly log;
constructor(channel: RTCDataChannel, opts: WebRTCDataChannelOptions);
send(data: Uint8Array): Promise<void>;
close(): void;
get bufferedAmount(): number;
}
//# sourceMappingURL=channel.d.ts.map