ServiceClient
Example:
import ServiceClient from "node_modules/servingjs/build/ServiceClient.js";
const service_provider = new ServiceClient("http://localhost:8000");
const result = await service_client.proxy.example_function(3, 39);
// client.close(); // (Node.js only)
Constructor Summary
Public Constructor | ||
public |
constructor(url: string, options: object) Constructs the ServiceClient. |
Member Summary
Public Members | ||
public |
Provides a proxy to adress service functions like object properties. |
Protected Members | ||
protected |
Specifies the service provider's location. |
|
protected |
Specifies the service provider's location. |
Method Summary
Public Methods | ||
public |
This method closes the http2 client on Node.js. |
Protected Methods | ||
protected |
_makeRequest(service_function_name: string): * This method replaces itself a the first invocation with either the |
|
protected |
_makeRequestFetch(service_function_name: string): * This method make the network request when |
|
protected |
_makeRequestNode(service_function_name: string): * This method make the network request when |
Public Constructors
Public Members
Protected Members
Public Methods
public async close(): boolean source
This method closes the http2 client on Node.js. In a browser context this method does nothing.
Protected Methods
protected _makeRequest(service_function_name: string): * source
This method replaces itself a the first invocation with either the _makeRequestFetch
or the _makeRequestNode
method according to the context.
Subsequently calls the replacing method.
Params:
Name | Type | Attribute | Description |
service_function_name | string | name of the requested service function |
Return:
* | response_value - response from the requested service function |
protected _makeRequestFetch(service_function_name: string): * source
This method make the network request when fetch
is available.
Params:
Name | Type | Attribute | Description |
service_function_name | string | name of the requested service function |
Return:
* | response_value - response from the requested service function |
protected _makeRequestNode(service_function_name: string): * source
This method make the network request when http2
is available (on Node.js).
Params:
Name | Type | Attribute | Description |
service_function_name | string | name of the requested service function |
Return:
* | response_value - response from the requested service function |