HTTP Transport

The HTTP transport uses http requests to communicate.

Installation

The HTTP transport is not bundled with Hudson Taylor by default.

To install:

npm install ht-http-transport --save

Options

NameTypeRequiredExampleDefaultDescription
hoststring “127.0.0.1”“0.0.0.0”Network address to listen on.
portnumber1234N/ANetwork port to listen on.
pathstring “/endpoint”“/ht”Path to accept requests on.
sslObject { cert, key }N/AEnable SSL
agenthttp.Agent  N/ATo manage connection persistence
timeoutnumber 1800N/ATimeout before the socket is connected

Example

var htHTTPTransport = require('ht-http-transport')
var http = require('http')

var keepAliveAgent = new http.Agent({ keepAlive: true })
var transport = new ht.Transport.HTTP({
  host: "127.0.0.1",
  port: 1337,
  path: "/endpoint",
  ssl: {
    cert: "...",
    key: "..."
  },
  agent: keepAliveAgent,
  timeout: 1000
})