-
Notifications
You must be signed in to change notification settings - Fork 28
Lite API: Resource
Parent Document: ANT APIs
Resource API comprises of resource-server functions and resource-client functions.
Submodules in ANT framework communicates each other by the Resource API.
Resource API routes the resource request/response messages to the destination resource, and then internally calls IPC or RPC functions.
In ANT Classic, since resource library can be accessed by only native-C function call, it is difficult to use the resource interfaces. On the other hand, ANT Lite provides JavaScript-based resource API for easier application of resource interfaces.
You need to load resource API module before you use its API as following.
var resourceAPI = require('ant').resource;
requestGet(String targetUri, String message, Function onResourceResponse);
-
targetUri: Target URI -
message: Message to be delivered -
onResourceResponse: Function to perform when response is received
var onReceiveMessage = function (method, targetUri, message) {
var startTime = parseInt(message);
var endTime = new Date().valueOf();
var timeMS = endTime - startTime;
totalCount++;
console.log(
'(' +
totalCount +
')' +
'Resource API mode elapsed time: ' +
timeMS +
'ms'
);
};
var startTimeValue = new Date().valueOf();
var startTime = '**ResourceBench** ' + startTimeValue;
resourceAPI.requestGet('/resourcebench', startTime, onReceiveMessage);requestPost(String targetUri, String message, Function onResourceResponse);
-
targetUri: Target URI -
message: Message to be delivered -
onResourceResponse: Function to perform when response is received
ANTRemoteUI.prototype.setStreamingViewPipeline = function (pipeline, handler) {
resourceAPI.requestPost(
'/remoteui/streamingview/pipeline',
pipeline,
handler
);
};requestPut(String targetUri, String message, Function onResourceResponse);
-
targetUri: Target URI -
message: Message to be delivered -
onResourceResponse: Function to perform when response is received
requestDelete(String targetUri, String message, Function onResourceResponse);
-
targetUri: Target URI -
message: Message to be delivered -
onResourceResponse: Function to perform when response is received
- Home
- About
- Getting Started
-
ANT APIs
- ANT Classic API
- ANT Lite API
- Getting Involved