@aritsum/sdk-aeolix-nodejs v0.3.4
SDK for nodeJS version 0.3.Xs
(This repository is part of the AEOLIX platform and contains only the Software Development Toolkit)
Pre-requisites
Install the sdk and import it in your project
npm install aeolixsdk-node
var AeolixSDK = require('aeolixsdk-node');
Instance the SDK
var sdk = new AeolixSDK([args]);
Arguments:
- args: any
{
"autoRefresh": boolean
}
Login
The loging to the AEOLIX platform is made throught the keycloak IDM.
Login throught Keycloak with username and password
sdk.login(userData, control);
Arguments:
- userData: any
{
"username":"username",
"password":"pwd",
"type":"user"
}
- control: function to receive server responses.
Set Token
Loging to the AEOLIX platform using a token from a previous login.
Login throught Keycloak with access token
sdk.setToken(accessToken, control);
Arguments:
- accessToken: token from a previous login response
- control: function to receive server responses.
Refresh token
Refresh the token previously generated by login or token exchange throught Keycloak. Version 0.3.2 and higher don't refresh the token automatically
Refres access token throught Keycloak
sdk.refreshToken(control);
Arguments:
- control: function to receive server responses.
Publish
This functionality allows to publish a message.
sdk.publish(dataSourceID, data, control);
Arguments:
- dataSourceID: data source granted for publish.
- data: String containing the data to be published.
- control: function to receive server responses.
Subscribe
This functionality allows to subscribe to an specific datasource and receive all the published information.
sdk.subscribe(dataSourceID, callback, control);
Arguments:
- DatasourceID: Datasource granted for subscribtion.
- callback: callback function to receive AEOLIX data messages.
- control: function to receive server responses.
Each time that a message arrives, the callback will be executed to receive the data message.
Unsubscribe
This operation will allow to stop receiving data from a subscription.
sdk.unsubscribe(dataSourceID, control);
Arguments:
- DatasourceID: Datasource previously subscribed.
- control: function to receive server responses.
Send Service Request
This functionality allows to publish a service request.
sdk.sendServiceRequest(serviceID, payload, control);
Arguments:
- serviceID: service granted for access.
- payload: String containing the request payload.
- control: function to receive server responses.
Subscribe to Service Request
This functionality allows to subscribe to an specific service and receive all the user's requests.
sdk.subscribe2ServiceRequest(serviceID, callback, control);
Arguments:
- serviceID: service owned.
- callback: callback function to receive AEOLIX service requests.
- control: function to receive server responses.
Each time that a message arrives, the callback will be executed to receive the data message.
Unsubscribe Service Request
This operation will allow to stop receiving data from a service request subscription.
sdk.unsubscribeServiceRequest(serviceID, control);
Arguments:
- serviceID: service previously subscribed.
- control: function to receive server responses.
Send Service Response
This functionality allows to publish a service response.
sdk.sendServiceResponse(serviceID, userID, payload, control);
Arguments:
- serviceID: service owned.
- userID: user to send response.
- payload: String containing the response payload.
- control: function to receive server responses.
Subscribe to Service Response
This functionality allows to subscribe to an specific service and receive all the owner responses.
sdk.subscribe2ServiceResponse(serviceID, callback, control);
Arguments:
- serviceID: service granted to access.
- callback: callback function to receive AEOLIX service responses.
- control: function to receive server responses.
Each time that a message arrives, the callback will be executed to receive the data message.
Unsubscribe Service Response
This operation will allow to stop receiving data from a service response subscription.
sdk.unsubscribeServiceResponse(serviceID, control);
Arguments:
- serviceID: service previously subscribed.
- control: function to receive server responses.
In Use
Currently MyAEOLIX is under development.
License
Due the interoperability needs of these architectures, MyAEOLIX has been fully designed considering Free Libre Open Source Software technologies. The project has been designed and implemented by the Transport Sector in the Research & Innovation department in ATOS Spain.
4 years ago