(This repository is part of the AEOLIX platform and contains only the Software Development Toolkit)
Install the sdk and import it and socket.io in your project
npm install aeolixsdk-js
<script type="text/javascript" src="../src/aeolixSDK.js"></script>
<script type="text/javascript" src="../src/socket.io.js"></script>
var sdk = new AeolixSDK([args]);
- args: any
{
"autoRefresh": boolean
}
The loging to the AEOLIX platform is made throught the keycloak IDM.
sdk.login(userData, control);
- userData: any
{
"username":"username",
"password":"pwd",
"type":"user"
}
- control: function to receive server responses.
Loging to the AEOLIX platform using a token from a previous login.
sdk.setToken(accessToken, control);
- accessToken: token from a previous login response
- control: function to receive server responses.
Refresh the token previously generated by login or token exchange throught Keycloak. Version 0.3.2 and higher don't refresh the token automatically
sdk.refreshToken(control);
- control: function to receive server responses.
This functionality allows to publish a message.
sdk.publish(dataSourceID, data, control);
- dataSourceID: data source granted for publish.
- data: String containing the data to be published.
- control: function to receive server responses.
This functionality allows to subscribe to an specific datasource and receive all the published information.
sdk.subscribe(dataSourceID, callback, control);
- 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.
This operation will allow to stop receiving data from a subscription.
sdk.unsubscribe(dataSourceID, control);
- DatasourceID: Datasource previously subscribed.
- control: function to receive server responses.
This functionality allows to publish a service request.
sdk.sendServiceRequest(serviceID, payload, control);
- serviceID: service granted for access.
- payload: String containing the request payload.
- control: function to receive server responses.
This functionality allows to subscribe to an specific service and receive all the user's requests.
sdk.subscribe2ServiceRequest(serviceID, callback, control);
- 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.
This operation will allow to stop receiving data from a service request subscription.
sdk.unsubscribeServiceRequest(serviceID, control);
- serviceID: service previously subscribed.
- control: function to receive server responses.
This functionality allows to publish a service response.
sdk.sendServiceResponse(serviceID, userID, payload, control);
- serviceID: service owned.
- userID: user to send response.
- payload: String containing the response payload.
- control: function to receive server responses.
This functionality allows to subscribe to an specific service and receive all the owner responses.
sdk.subscribe2ServiceResponse(serviceID, callback, control);
- 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.
This operation will allow to stop receiving data from a service response subscription.
sdk.unsubscribeServiceResponse(serviceID, control);
- serviceID: service previously subscribed.
- control: function to receive server responses.
Currently MyAEOLIX is under development.
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.