Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Connection

Hierarchy

  • EventEmitter
    • Connection

Constructors

constructor

Properties

Optional connectionTag

connectionTag: undefined | string

Application identifier for a certain connection

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

destinationAccount

destinationAccount:

ILP Address of the remote party to this connection.

destinationAssetCode

destinationAssetCode:

Code of the asset used by the remote party to this connection

destinationAssetScale

destinationAssetScale:

Scale of the asset used by the remote party to this connection

lastPacketExchangeRate

lastPacketExchangeRate:

Calculates the last exchange rate based on last packet successfully sent.

minimumAcceptableExchangeRate

minimumAcceptableExchangeRate:

Connections minimum exchange rate with slippage included, if not set '0' is returned.

sourceAccount

sourceAccount:

ILP Address of the plugin passed to this connection.

sourceAssetCode

sourceAssetCode:

Code of the asset used by the plugin passed to this connection

sourceAssetScale

sourceAssetScale:

Scale of the asset used by the plugin passed to this connection

totalDelivered

totalDelivered:

Total delivered so far, denominated in the connection plugin's units.

totalReceived

totalReceived:

Total received so far by the local side, denominated in the connection plugin's units.

totalSent

totalSent:

Total sent so far, denominated in the connection plugin's units.

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

connect

  • connect(): Promise<void>
  • Start sending or receiving.

    fires

    stream

    Returns Promise<void>

createStream

destroy

  • destroy(err: Error): Promise<void>
  • Immediately close the connection and all streams.

    This function must never return a rejection, since startSendLoop is run as a floating promise and returns destroy() on errors, so the rejection would be unhandled.

    This function must never return a rejection, since startSendLoop is run as a floating promise and returns destroy() on errors, so the rejection would be unhandled.

    Parameters

    Returns Promise<void>

emit

  • emit(event: string | symbol, args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest args: any[]

    Returns boolean

end

  • end(): Promise<void>
  • Close the connection when all streams have finished sending their money and data

    Returns Promise<void>

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Private handlePrepare

  • handlePrepare(prepare: IlpPrepare): Promise<IlpFulfill>
  • (Internal) Handle incoming ILP Prepare packets. This will automatically fulfill all valid and expected Prepare packets, or defer to custom application logic using the shouldFulfill callback, if provided. It passes the incoming money and/or data to the relevant streams.

    Parameters

    • prepare: IlpPrepare

    Returns Promise<IlpFulfill>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static Private build

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc