Skip to content

airtrik/javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airtrik javascript

Airtrik is an IoT Cloud platform for managing communication between IoT devices and software platforms. This is the javascript library that can be used for communicating to IoT device connected to your airtrik app network.

Summary

Getting Started

Follow the below instructions to get your device and application up and running within minutes. It is very easy to integrate airtrik into your project.

Prerequisites

Before proceeding further you have would need a webserver to run your html file.

Install apache
Or you can use node server also

Installing

Airtrik javascript library can easily be loaded to any webpage/web app through cdn following is the link which you need to add to the head tag of your HTML page.

<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.airtrik.com/js/0.1.1/index.js" type="text/javascript"></script>

Connecting to your App's Network

// create an app in the panel to get the app key
AIRTRIK_connect("__APP_KEY__")

Subscribe to device in App's Network

// you have to create device inside app from panel
var device = __DEVICE_ID__
// you can only subscribe to any device inside the onConnect callback function
onConnect = ()=>{
  subscribe(device)
}

Sending message to device

message = "YOUR MESSAGE TO DEVICE"
send(device, message)

Receiving messages from device

// you can write your custom function handling the incoming message
onReceive = (message, deviceId)=>{
  console.log(message)
  console.log(deviceId)
}

Versioning

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT Creative Commons License - see the LICENSE file for details

About

Airtrik is an IoT Cloud platform for managing communication between IoT devices and software platforms.

Resources

Stars

Watchers

Forks

Packages

No packages published