API Reference
October 7, 2022 · View on GitHub
OpenZiti SDK for Node.js
- @openziti/ziti-sdk-nodejs
- ~close(conn) ⇒
void - ~dial(serviceName, isWebSocket, onConnect, onData) ⇒
void - ~express(express, serviceName) ⇒
* - ~httpRequest(serviceName, schemeHostPort, method, path, headers, onRequest, onResponse, onResponseData) ⇒
void - ~httpRequestData(req, data, onRequestData) ⇒
void - ~httpRequestEnd(req) ⇒
void - ~init(identityPath) ⇒
number - ~setLogLevel(level) ⇒
void - ~serviceAvailable(serviceName, onServiceAvailable) ⇒
void - ~write(conn, data, onWrite) ⇒
void - ~onDataCallback :
function - ~onConnectCallback ⇒
void - ~onRequestCallback ⇒
void - ~onResonseCallback ⇒
void - ~onResonseDataCallback ⇒
void - ~onRequestDataCallback ⇒
void - ~onServiceAvailableCallback ⇒
void - ~onWriteCallback ⇒
void
- ~close(conn) ⇒
@openziti/ziti-sdk-nodejs~close(conn) ⇒ void
Close a Ziti connection.
Kind: inner method of @openziti/ziti-sdk-nodejs
Returns: void - No return value.
| Param | Type | Description |
|---|---|---|
| conn | number | A 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.
| Param | Type | Description |
|---|---|---|
| serviceName | string | The name of the Ziti Service to connect to |
| isWebSocket | boolean | True or False indicator concerning whether this connection if bi-directional. |
| onConnect | onConnectCallback | The callback that receives the connection handle. |
| onData | onDataCallback | The 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.
| Param | Type | Description |
|---|---|---|
| express | * | The express() object. |
| serviceName | string | The 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.
| Param | Type | Description |
|---|---|---|
| serviceName | string | The name of the Ziti Service to send the request. (mutually exclusive with url) |
| schemeHostPort | string | The scheme/host/port (e.g. http://myserver.ziti:8080) of a Ziti service-config/intercept to send the request. (mutually exclusive with serviceName) |
| method | string | The REST verb to use (e.g. GET, POST). |
| path | string | The URL PATH to use on the request (can include HTTP query parms). |
| headers | Array.<string> | The HTTP Headers to use on the request. |
| onRequest | onRequestCallback | The callback that receives the request handle. |
| onResponse | onResonseCallback | The callback that receives the HTTP Response. |
| onResponseData | onResonseDataCallback | The 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.
| Param | Type | Description |
|---|---|---|
| req | number | A Ziti HttpRequest handle. |
| data | Buffer | The HTTP payload data to send. |
| onRequestData | onRequestDataCallback | The 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.
| Param | Type | Description |
|---|---|---|
| req | number | A 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.
| Param | Type | Description |
|---|---|---|
| identityPath | string | File 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.
| Param | Type | Description |
|---|---|---|
| level | number | 0=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.
| Param | Type | Description |
|---|---|---|
| serviceName | string | The name of the Ziti Service being queried. |
| onServiceAvailable | onServiceAvailableCallback | The 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.
| Param | Type | Description |
|---|---|---|
| conn | number | A Ziti connection handle. |
| data | Buffer | The data to send. |
| onWrite | onWriteCallback | The 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
| Param | Type | Description |
|---|---|---|
| conn | number | A 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.
| Param | Type | Description |
|---|---|---|
| data | Buffer | Incoming 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.
| Param | Type | Description |
|---|---|---|
| req | number | A 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.
| Param | Description |
|---|---|
| resp | Incoming response from the HTTP request. |
| resp.req | The request handle. |
| resp.code | The HTTP status code. |
| resp.headers | The 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.
| Param | Description |
|---|---|
| respData | Incoming response data from the HTTP request. |
| respData.req | The request handle. |
| respData.len | The length of the response body. |
| respData.body | The 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.
| Param | Description |
|---|---|
| reqData | Incoming status data from the HTTP request. |
| respData.req | The request handle. |
| respData.status | positive 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.
| Param | Description |
|---|---|
| availability | results of the query. |
| availability.status | 0 means available and OK, <0 means unavailable |
| availability.permissions | 1 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.
| Param | Description |
|---|---|
| status | 0 means success, <0 means failure. |