Class Protomux<TStream>

Type Parameters

  • TStream extends Duplex | NodeDuplex = Duplex

Constructors

  • Type Parameters

    • TStream extends Duplex | Duplex<any, any, any, any, true, true, DuplexEvents<any, any>> = Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>

    Parameters

    Returns Protomux<TStream>

Properties

isProtomux: true
stream: TStream

Methods

  • Returns IterableIterator<Channel, any, any>

  • Returns void

  • Parameters

    • opts: {
          aliases?: string[];
          handshake?: any;
          id?: null | Buffer;
          messages: Partial<Pick<Message, "onmessage" | "encoding">>[];
          protocol: string;
          unique?: boolean;
          userData?: any;
          onclose?(): void | Promise<void>;
          ondestroy?(): void | Promise<void>;
          onopen?(handshake?: any): void | Promise<void>;
      }
      • Optionalaliases?: string[]
      • Optionalhandshake?: any
      • Optionalid?: null | Buffer
      • messages: Partial<Pick<Message, "onmessage" | "encoding">>[]
      • protocol: string
      • Optionalunique?: boolean
      • OptionaluserData?: any
      • onclose?:function
        • Returns void | Promise<void>

      • ondestroy?:function
        • Returns void | Promise<void>

      • onopen?:function
        • Parameters

          • Optionalhandshake: any

          Returns void | Promise<void>

    Returns Channel

  • Parameters

    • err: Error

    Returns void

  • Parameters

    • opts: {
          id?: null | Buffer;
          protocol: string;
      }
      • Optionalid?: null | Buffer
      • protocol: string

    Returns boolean

  • Parameters

    • opts: {
          id?: null | Buffer;
          protocol: string;
      }
      • Optionalid?: null | Buffer
      • protocol: string
    • notify: ((id: Buffer) => Promise<void>)
        • (id): Promise<void>
        • Parameters

          • id: Buffer

          Returns Promise<void>

    Returns void

  • Returns void

  • Parameters

    • opts: {
          id?: null | Buffer;
          protocol: string;
      }
      • Optionalid?: null | Buffer
      • protocol: string

    Returns void

  • Parameters

    • stream: TStream

    Returns Protomux<TStream>

  • Parameters

    • mux: unknown

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