Connection Class

Create a connection customer that will listen to result send to the particular port.

1.0.0

Hierarchy

  • EventEmitter
    • Connection

Implements

Constructors

  • Parameters

    • client: default

      The client parent that we are connecting too.

    • props: ClientListenerOptions

      The individual port connection options. Some values will be defaulted by the parent server connection.

    • handler: OutboundHandler

      The function that will send the returned information back to the client after we got a response from the server.

    Returns Connection

    1.0.0

    const OB = client.createConnection({ port: 3000 }, async (res) => {})
    

Methods

  • Close Client Listener Instance.

    Returns Promise<void>

    Force close a connection. It will stop any re-connection timers. If you want to restart, your app has to restart the connection.

    1.0.0

    OB.close()
    
  • Get Port

    Returns number

    Get the port that this connection will connect to.

    2.0.0

  • Send a HL7 Message to the Listener

    Parameters

    Returns Promise<void>

    This function sends a message/batch/file batch to the remote side. It has the ability, if set to auto-retry (defaulted to 1 re-connect before connection closes)

    1.0.0


    // the OB was set from the orginial 'createConnection' method.

    let message = new Message({
    messageHeader: {
    msh_9_1: "ADT",
    msh_9_2: "A01",
    msh_11_1: "P" // marked for production here in the example
    }async sendMessage (message: Message | Batch | FileBatch): void {
    })

    await OB.sendMessage(message)