App Connecting to an Edge

Pre-requisites:

  1. You have created a developer account with ClearBlade (https://platform.clearblade.com).
  2. You have logged in with the developer account and created a System on the ClearBlade Platform.
  3. You have created User accounts on the ClearBlade Platform.

Connect a Web application to an Edge

  1. Your edge will run at a default port of 9000. If your SDK is running on the same box, then your URI will be “http://localhost:9000"
  2. Connecting a web application to an Edge is similar to using our JavaScript SDK. You need to just change the initOptions according to your Edge Settings.
  3. Refer to the JavaScript SDK
<script>
var cb = new ClearBlade();

/*
Example
Var initOptions = {
URI : ‘http://192.168.0.92’,
messagingURI : ‘192.168.0.92’,
messagingPort: 8904,
useMQTT: true,
cleanSession: true,
systemKey: ‘f887dxxxxxxxxxxxxxxxxxxxxxxx01’,
systemSecret: ‘F887DCxxxxxxxxxxxxxxxxxxxxxx01’
Email: ‘fan@cb.com’
password: ‘password’
*/

var initOptions = {
URI : <IP_ADDRESS_OF_EDGE>, 
messagingURI : <IP_ADDRESS_OF_EDGE>,  
messagingPort:<MESSAGE_PORT>, 
useMQTT: true,
cleanSession: true,
systemKey: <EDGE_SYSTEM_KEY>, 
systemSecret: <EDGE_SYSTEM_SECRET> ,
email:<USER_EMAIL>,
password:<USER_PASSWORD>
};

</script>