Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"Buffer": true,
"escape": true
},
"rules": {
"quotes": [2, "single"],
"strict": 0,
"eol-last": ["error", "always"],
"curly": 0,
"no-empty": 0,
"no-underscore-dangle": 0,
"new-cap": 0,
"dot-notation": 0,
"no-use-before-define": 0,
"semi": [2, "always"],
"keyword-spacing": [2, {"before": true, "after": true}],
"space-before-blocks": [2, "always"],
"no-trailing-spaces": 2,
"space-unary-ops": 0
},
"parserOptions": {
"ecmaVersion": 2017
}
}
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [10.x]
node-version: [10.x, 12.x, 14.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [10.x]
node-version: [10.x, 12.x]
test-type: [websocket, certificate, custom-auth]

steps:
Expand Down
4 changes: 2 additions & 2 deletions device/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ function DeviceClient(options) {
//
// Validate options, set default reconnect period if not specified.
//
var metricPrefix = "?SDK=JavaScript&Version=";
var metricPrefix = '?SDK=JavaScript&Version=';
var pjson = require('../package.json');
var sdkVersion = pjson.version;
var defaultUsername = metricPrefix + sdkVersion;
Expand All @@ -375,7 +375,7 @@ function DeviceClient(options) {
//
// Metrics will be enabled by default unless the user explicitly disables it
//
if (isUndefined(options.enableMetrics) || options.enableMetrics === true){
if (isUndefined(options.enableMetrics) || options.enableMetrics === true) {
if (isUndefined(options.username)) {
options.username = defaultUsername;
} else {
Expand Down
22 changes: 11 additions & 11 deletions examples/browser/lifecycle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*/

//
// Instantiate the AWS SDK and configuration objects. The AWS SDK for
// JavaScript (aws-sdk) is used for Cognito Identity/Authentication, and
// Instantiate the AWS SDK and configuration objects. The AWS SDK for
// JavaScript (aws-sdk) is used for Cognito Identity/Authentication, and
// the AWS IoT SDK for JavaScript (aws-iot-device-sdk) is used for the
// WebSocket connection to AWS IoT and device shadow APIs.
//
//
var AWS = require('aws-sdk');
var AWSIoTData = require('aws-iot-device-sdk');
var AWSConfiguration = require('./aws-configuration.js');
Expand Down Expand Up @@ -50,7 +50,7 @@ AWS.config.credentials = new AWS.CognitoIdentityCredentials({
});

//
// Create the AWS IoT device object. Note that the credentials must be
// Create the AWS IoT device object. Note that the credentials must be
// initialized with empty strings; when we successfully authenticate to
// the Cognito Identity Pool, the credentials will be dynamically updated.
//
Expand Down Expand Up @@ -82,7 +82,7 @@ const mqttClient = AWSIoTData.device({
//
debug: true,
//
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// initialized with empty strings.
//
accessKeyId: '',
Expand All @@ -92,7 +92,7 @@ const mqttClient = AWSIoTData.device({

//
// Attempt to authenticate to the Cognito Identity Pool. Note that this
// example only supports use of a pool which allows unauthenticated
// example only supports use of a pool which allows unauthenticated
// identities.
//
var cognitoIdentity = new AWS.CognitoIdentity();
Expand Down Expand Up @@ -167,8 +167,8 @@ AWS.config.credentials.get(function(err, data) {
//
window.mqttClientConnectHandler = function() {
console.log('connect');
document.getElementById("connecting-div").style.visibility = 'hidden';
document.getElementById("clients-div").style.visibility = 'visible';
document.getElementById('connecting-div').style.visibility = 'hidden';
document.getElementById('clients-div').style.visibility = 'visible';

//
// We only subscribe to lifecycle events once.
Expand All @@ -184,8 +184,8 @@ window.mqttClientConnectHandler = function() {
//
window.mqttClientReconnectHandler = function() {
console.log('reconnect');
document.getElementById("connecting-div").style.visibility = 'visible';
document.getElementById("clients-div").style.visibility = 'hidden';
document.getElementById('connecting-div').style.visibility = 'visible';
document.getElementById('clients-div').style.visibility = 'hidden';
};

//
Expand Down Expand Up @@ -225,7 +225,7 @@ window.mqttClientMessageHandler = function(topic, payload) {
//
clientDiv.parentNode.removeChild(clientDiv);
//
// Forget this client
// Forget this client
//
delete clients[divName];
}
Expand Down
20 changes: 10 additions & 10 deletions examples/browser/mqtt-explorer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*/

//
// Instantiate the AWS SDK and configuration objects. The AWS SDK for
// JavaScript (aws-sdk) is used for Cognito Identity/Authentication, and
// Instantiate the AWS SDK and configuration objects. The AWS SDK for
// JavaScript (aws-sdk) is used for Cognito Identity/Authentication, and
// the AWS IoT SDK for JavaScript (aws-iot-device-sdk) is used for the
// WebSocket connection to AWS IoT and device shadow APIs.
//
//
var AWS = require('aws-sdk');
var AWSIoTData = require('aws-iot-device-sdk');
var AWSConfiguration = require('./aws-configuration.js');
Expand Down Expand Up @@ -50,7 +50,7 @@ AWS.config.credentials = new AWS.CognitoIdentityCredentials({
});

//
// Create the AWS IoT device object. Note that the credentials must be
// Create the AWS IoT device object. Note that the credentials must be
// initialized with empty strings; when we successfully authenticate to
// the Cognito Identity Pool, the credentials will be dynamically updated.
//
Expand Down Expand Up @@ -81,7 +81,7 @@ const mqttClient = AWSIoTData.device({
//
debug: true,
//
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// initialized with empty strings.
//
accessKeyId: '',
Expand All @@ -91,7 +91,7 @@ const mqttClient = AWSIoTData.device({

//
// Attempt to authenticate to the Cognito Identity Pool. Note that this
// example only supports use of a pool which allows unauthenticated
// example only supports use of a pool which allows unauthenticated
// identities.
//
var cognitoIdentity = new AWS.CognitoIdentity();
Expand Down Expand Up @@ -127,8 +127,8 @@ AWS.config.credentials.get(function(err, data) {
//
window.mqttClientConnectHandler = function() {
console.log('connect');
document.getElementById("connecting-div").style.visibility = 'hidden';
document.getElementById("explorer-div").style.visibility = 'visible';
document.getElementById('connecting-div').style.visibility = 'hidden';
document.getElementById('explorer-div').style.visibility = 'visible';
document.getElementById('subscribe-div').innerHTML = '<p><br></p>';
messageHistory = '';

Expand All @@ -143,8 +143,8 @@ window.mqttClientConnectHandler = function() {
//
window.mqttClientReconnectHandler = function() {
console.log('reconnect');
document.getElementById("connecting-div").style.visibility = 'visible';
document.getElementById("explorer-div").style.visibility = 'hidden';
document.getElementById('connecting-div').style.visibility = 'visible';
document.getElementById('explorer-div').style.visibility = 'hidden';
};

//
Expand Down
14 changes: 7 additions & 7 deletions examples/browser/mqtt-webpack/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AWS.config.credentials = new AWS.CognitoIdentityCredentials({
});

//
// Create the AWS IoT device object. Note that the credentials must be
// Create the AWS IoT device object. Note that the credentials must be
// initialized with empty strings; when we successfully authenticate to
// the Cognito Identity Pool, the credentials will be dynamically updated.
//
Expand Down Expand Up @@ -58,7 +58,7 @@ const mqttClient = AWSIoTData.device({
//
debug: true,
//
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// initialized with empty strings.
//
accessKeyId: '',
Expand All @@ -68,7 +68,7 @@ const mqttClient = AWSIoTData.device({

//
// Attempt to authenticate to the Cognito Identity Pool. Note that this
// example only supports use of a pool which allows unauthenticated
// example only supports use of a pool which allows unauthenticated
// identities.
//
var cognitoIdentity = new AWS.CognitoIdentity();
Expand Down Expand Up @@ -104,8 +104,8 @@ AWS.config.credentials.get(function(err, data) {
//
window.mqttClientConnectHandler = function() {
console.log('connect');
document.getElementById("connecting-div").style.visibility = 'hidden';
document.getElementById("explorer-div").style.visibility = 'visible';
document.getElementById('connecting-div').style.visibility = 'hidden';
document.getElementById('explorer-div').style.visibility = 'visible';
document.getElementById('subscribe-div').innerHTML = '<p><br></p>';
messageHistory = '';

Expand All @@ -120,8 +120,8 @@ window.mqttClientConnectHandler = function() {
//
window.mqttClientReconnectHandler = function() {
console.log('reconnect');
document.getElementById("connecting-div").style.visibility = 'visible';
document.getElementById("explorer-div").style.visibility = 'hidden';
document.getElementById('connecting-div').style.visibility = 'visible';
document.getElementById('explorer-div').style.visibility = 'hidden';
};

//
Expand Down
4 changes: 2 additions & 2 deletions examples/browser/mqtt-webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
entry: "./entry.js",
entry: './entry.js',
output: {
path: __dirname,
filename: "bundle.js"
filename: 'bundle.js'
},
node: {
fs: 'empty',
Expand Down
26 changes: 13 additions & 13 deletions examples/browser/temperature-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*/

//
// Instantiate the AWS SDK and configuration objects. The AWS SDK for
// JavaScript (aws-sdk) is used for Cognito Identity/Authentication, and
// Instantiate the AWS SDK and configuration objects. The AWS SDK for
// JavaScript (aws-sdk) is used for Cognito Identity/Authentication, and
// the AWS IoT SDK for JavaScript (aws-iot-device-sdk) is used for the
// WebSocket connection to AWS IoT and device shadow APIs.
//
//
var AWS = require('aws-sdk');
var AWSIoTData = require('aws-iot-device-sdk');
var AWSConfiguration = require('./aws-configuration.js');
Expand All @@ -41,7 +41,7 @@ AWS.config.credentials = new AWS.CognitoIdentityCredentials({
var shadowsRegistered = false;

//
// Create the AWS IoT shadows object. Note that the credentials must be
// Create the AWS IoT shadows object. Note that the credentials must be
// initialized with empty strings; when we successfully authenticate to
// the Cognito Identity Pool, the credentials will be dynamically updated.
//
Expand All @@ -52,7 +52,7 @@ const shadows = AWSIoTData.thingShadow({
region: AWS.config.region,
//
//Set the AWS IoT Host Endpoint
//
//
host:AWSConfiguration.host,
//
// Use a random client ID.
Expand All @@ -73,7 +73,7 @@ const shadows = AWSIoTData.thingShadow({
//
debug: true,
//
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// IMPORTANT: the AWS access key ID, secret key, and sesion token must be
// initialized with empty strings.
//
accessKeyId: '',
Expand Down Expand Up @@ -129,7 +129,7 @@ shadows.on('status', function(name, statusType, clientToken, stateObject) {

//
// Attempt to authenticate to the Cognito Identity Pool. Note that this
// example only supports use of a pool which allows unauthenticated
// example only supports use of a pool which allows unauthenticated
// identities.
//
var cognitoIdentity = new AWS.CognitoIdentity();
Expand Down Expand Up @@ -165,9 +165,9 @@ AWS.config.credentials.get(function(err, data) {
//
window.shadowConnectHandler = function() {
console.log('connect');
document.getElementById("connecting-div").style.visibility = 'hidden';
document.getElementById("temperature-monitor-div").style.visibility = 'visible';
document.getElementById("temperature-control-div").style.visibility = 'visible';
document.getElementById('connecting-div').style.visibility = 'hidden';
document.getElementById('temperature-monitor-div').style.visibility = 'visible';
document.getElementById('temperature-control-div').style.visibility = 'visible';

//
// We only register our shadows once.
Expand Down Expand Up @@ -202,9 +202,9 @@ window.shadowConnectHandler = function() {
//
window.shadowReconnectHandler = function() {
console.log('reconnect');
document.getElementById("connecting-div").style.visibility = 'visible';
document.getElementById("temperature-monitor-div").style.visibility = 'hidden';
document.getElementById("temperature-control-div").style.visibility = 'hidden';
document.getElementById('connecting-div').style.visibility = 'visible';
document.getElementById('temperature-monitor-div').style.visibility = 'hidden';
document.getElementById('temperature-control-div').style.visibility = 'hidden';
};

//
Expand Down
Loading