Skip to content

Latest commit

 

History

History
199 lines (100 loc) · 2.51 KB

Protomux.md

File metadata and controls

199 lines (100 loc) · 2.51 KB

APIDocs


API / <internal> / Protomux

Class: Protomux<TStream>

Type Parameters

TStream extends Duplex | NodeDuplex = Duplex

Constructors

new Protomux()

new Protomux<TStream>(stream): Protomux<TStream>

Parameters

stream: TStream

Returns

Protomux<TStream>

Properties

isProtomux

isProtomux: true


stream

stream: TStream

Methods

[iterator]()

[iterator](): IterableIterator<Channel, any, any>

Returns

IterableIterator<Channel, any, any>


cork()

cork(): void

Returns

void


createChannel()

createChannel(opts): Channel

Parameters

opts

opts.aliases?: string[]

opts.handshake?: any

opts.id?: null | Buffer

opts.messages: Partial<Pick<Message, "onmessage" | "encoding">>[]

opts.protocol: string

opts.unique?: boolean

opts.userData?: any

opts.onclose?

opts.ondestroy?

opts.onopen?

Returns

Channel


destroy()

destroy(err): void

Parameters

err: Error

Returns

void


opened()

opened(opts): boolean

Parameters

opts

opts.id?: null | Buffer

opts.protocol: string

Returns

boolean


pair()

pair(opts, notify): void

Parameters

opts

opts.id?: null | Buffer

opts.protocol: string

notify

Returns

void


uncork()

uncork(): void

Returns

void


unpair()

unpair(opts): void

Parameters

opts

opts.id?: null | Buffer

opts.protocol: string

Returns

void


from()

static from(stream): Protomux<TStream>

Parameters

stream: TStream

Returns

Protomux<TStream>


isProtomux()

static isProtomux(mux): mux is Protomux<Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>>

Parameters

mux: unknown

Returns

mux is Protomux<Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>>