Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To develop a client application in Javascript, you must previously have the following JS files in the application directory:

You can find these Javascript here: https://github.com/onesaitplatform/onesait-cloud-platform-clientlibraries/tree/master/javascript-client/js

Example

The images shown in the tutorial use an additional file called JsonEditor.js to show the response more esthetically, but it is not strictly needed.

...

var config = {};

  • config['url'] = "http://wwwlab.onesaitplatform.onlinecom/iot-broker/message";

  • config['deviceTemplate'] = 'Ticketing App'; (Must be the same as the template you defined in IoTClient)

  • config['token'] = 'e7ef0742d09d4de5a3687f0cfdf7f626'; (deviceTemplate token)

  • config['device'] = 'Web'; (Name you will give to the device)

...

Once this step is done, you can invoke all the methods that are implemented in the OPClient object:

  • Join

  • Query

  • Insert

  • Update

  • UpdateById

  • Remove

  • RemoveById

  • Subscriptions

JOIN

The Join operation will be the first action to be made, because it allows you to connect to the defined IoTClient. If everything is OK, it will return the sessionKey, identifying the current session.

...

Both Native and SQL queries are accepted. You can also perform SQL queries including SELECT/UPDATE/DELETE.

...

Native

...

SQL

...

Image RemovedImage Added


TO-DO (EXAMPLE UPDATE/DELETE)

...

If you click in the example on 'subscribe', and then perform and insertion, if you go back to the subscribe tab, you will se that you received the instance you just inserted.

...

Full Example

...