API Reference

October 7, 2022 · View on GitHub

OpenZiti SDK for Node.js

@openziti/ziti-sdk-nodejs~close(conn) ⇒ void

Close a Ziti connection.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
connnumberA Ziti connection handle.

@openziti/ziti-sdk-nodejs~dial(serviceName, isWebSocket, onConnect, onData) ⇒ void

Create a connection to Ziti Service.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
serviceNamestringThe name of the Ziti Service to connect to
isWebSocketbooleanTrue or False indicator concerning whether this connection if bi-directional.
onConnectonConnectCallbackThe callback that receives the connection handle.
onDataonDataCallbackThe callback that receives incoming data from the connection.

@openziti/ziti-sdk-nodejs~express(express, serviceName) ⇒ *

Wrap ExpressJS to facilitate hosting (listening) on a Ziti Service instead of a TCP port.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: * - The wrapped express() object.

ParamTypeDescription
express*The express() object.
serviceNamestringThe name of the Ziti Service being served (hosted).

@openziti/ziti-sdk-nodejs~httpRequest(serviceName, schemeHostPort, method, path, headers, onRequest, onResponse, onResponseData) ⇒ void

Initiate an HTTP request to a Ziti Service.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
serviceNamestringThe name of the Ziti Service to send the request. (mutually exclusive with url)
schemeHostPortstringThe scheme/host/port (e.g. http://myserver.ziti:8080) of a Ziti service-config/intercept to send the request. (mutually exclusive with serviceName)
methodstringThe REST verb to use (e.g. GET, POST).
pathstringThe URL PATH to use on the request (can include HTTP query parms).
headersArray.<string>The HTTP Headers to use on the request.
onRequestonRequestCallbackThe callback that receives the request handle.
onResponseonResonseCallbackThe callback that receives the HTTP Response.
onResponseDataonResonseDataCallbackThe callback that receives the HTTP Response data.

@openziti/ziti-sdk-nodejs~httpRequestData(req, data, onRequestData) ⇒ void

Send payload data for HTTP POST request to a Ziti Service.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
reqnumberA Ziti HttpRequest handle.
dataBufferThe HTTP payload data to send.
onRequestDataonRequestDataCallbackThe callback that acknowleges the send.

@openziti/ziti-sdk-nodejs~httpRequestEnd(req) ⇒ void

Terminate payload data transmission for HTTP POST request to a Ziti Service.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
reqnumberA Ziti HttpRequest handle.

@openziti/ziti-sdk-nodejs~init(identityPath) ⇒ number

Initialize the Ziti session and authenticate with control plane.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: number - A status value ranging from 0 to 255.

ParamTypeDescription
identityPathstringFile system path to the identity file.

@openziti/ziti-sdk-nodejs~setLogLevel(level) ⇒ void

Set the logging level.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
levelnumber0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE

@openziti/ziti-sdk-nodejs~serviceAvailable(serviceName, onServiceAvailable) ⇒ void

Set the logging level.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
serviceNamestringThe name of the Ziti Service being queried.
onServiceAvailableonServiceAvailableCallbackThe callback that returns results of the query.

@openziti/ziti-sdk-nodejs~write(conn, data, onWrite) ⇒ void

write data to a Ziti connection.

Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
connnumberA Ziti connection handle.
dataBufferThe data to send.
onWriteonWriteCallbackThe callback that returns status of the write.

@openziti/ziti-sdk-nodejs~onDataCallback : function

This callback is part of the dial API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs

ParamTypeDescription
connnumberA Ziti connection handle.

@openziti/ziti-sdk-nodejs~onConnectCallback ⇒ void

This callback is part of the dial API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
dataBufferIncoming data from the Ziti connection.

@openziti/ziti-sdk-nodejs~onRequestCallback ⇒ void

This callback is part of the httpRequest API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamTypeDescription
reqnumberA Ziti HttpRequest handle.

@openziti/ziti-sdk-nodejs~onResonseCallback ⇒ void

This callback is part of the httpRequest API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamDescription
respIncoming response from the HTTP request.
resp.reqThe request handle.
resp.codeThe HTTP status code.
resp.headersThe HTTP Headers on the response.

@openziti/ziti-sdk-nodejs~onResonseDataCallback ⇒ void

This callback is part of the httpRequest API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamDescription
respDataIncoming response data from the HTTP request.
respData.reqThe request handle.
respData.lenThe length of the response body.
respData.bodyThe response body.

@openziti/ziti-sdk-nodejs~onRequestDataCallback ⇒ void

This callback is part of the httpRequestData API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamDescription
reqDataIncoming status data from the HTTP request.
respData.reqThe request handle.
respData.statuspositive value indicates successful transmit.

@openziti/ziti-sdk-nodejs~onServiceAvailableCallback ⇒ void

This callback is part of the serviceAvailable API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamDescription
availabilityresults of the query.
availability.status0 means available and OK, <0 means unavailable
availability.permissions1 means the identity can dial, 2 means the identity can bind

@openziti/ziti-sdk-nodejs~onWriteCallback ⇒ void

This callback is part of the write API.

Kind: inner typedef of @openziti/ziti-sdk-nodejs
Returns: void - No return value.

ParamDescription
status0 means success, <0 means failure.