Interface ConnRegistryAdapter<T, S, C, I>

Adapter, which handles incoming connections. It contains actual domain logic for each connection.

See ConnRegistry for generic types descriptions.

Type Parameters

  • T

  • S

  • C

  • I

Hierarchy

  • ConnRegistryAdapter

Properties

cleanup: ((handle, exception) => Promise<void>)

Type declaration

    • (handle, exception): Promise<void>
    • Called after handle finishes it's execution in any way, either by returning or throwing exception.

      Cleanup is supposed to clean up any resources associated with connection.

      It's optional to implement, in this sense, that properly implemented handle can do the same thing.

      Parameters

      • handle: Readonly<{
            conn: T;
            connConfigBus: StickySubscribable<C>;
            id: string;
            initData: I;
            setState: ((newConnState) => void);
            updateState: ((callback) => void);
        }>
      • exception: any

      Returns Promise<void>

handle: ((handle) => Promise<void>)

Type declaration

    • (handle): Promise<void>
    • Kind of main for this adapter. Promise should resolve when adapter is done handling this connection.

      Parameters

      • handle: Readonly<{
            conn: T;
            connConfigBus: StickySubscribable<C>;
            id: string;
            initData: I;
            setState: ((newConnState) => void);
            updateState: ((callback) => void);
        }>

      Returns Promise<void>

makeInitialConfig: ((conn, initData, id) => C)

Type declaration

    • (conn, initData, id): C
    • Parameters

      • conn: T
      • initData: I
      • id: string

      Returns C

makeInitialState: ((conn, config, initData, id) => S)

Type declaration

    • (conn, config, initData, id): S
    • Parameters

      • conn: T
      • config: C
      • initData: I
      • id: string

      Returns S

modifyConfigOnRemove: ((config) => C)

Type declaration

    • (config): C
    • Gives adapter chance to handle some closing procedure when connection removal starts.

      Parameters

      • config: C

      Returns C

Generated using TypeDoc