iot-mock-clients v1.0.5
README
Overview
The iot-mock-clients.js package includes a demo client application which is based on the aws-iot-device-sdk for Javascript package and will give you a short Introduction about the AWS Iot Platform.
Installation
Installing with npm:
npm install iot-mock-clients
Installing from Bitbucket:
git clone https://git@bitbucket.org/umwerk/iot-mock-clients.git
cd iot-mock-clients
npm install
Creating / connecting a thing
In order to connect a JS Client it is necessary to register a thing within the AWS IoT device registry. Furthermore a client certificate is required. The folder certs/default/ contains a valid certificate (with all access policies set), so this one can be used.
- create a thing in the AWS device registry (with a unique thingName) - http://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html
- (optional) create a new client certificate and attach it to the policy "umwerk-test-3-Policy"
- attach the thing to the certificate from step 2 OR to the default certificate (cert/992c74a19b162bdc649ff352fa862fa141ea04a3e98ec641032684b445142526)
Note: The thingName must be unique. If a second client with the same thingName connects, the other one will be disconnected by the AWS IoT Hub.
Certificate files generated by AWS IoT have the following format:
- -private.pem.key
- -certificate.pem.crt
- root-CA.crt
If the default certificate is used, the client can be started like this (in the root folder):
node index.js --thingName <thingName>
If a new certificate was created:
node index.js --thingName <thingName> --certFolder <path/to/cert-folder> --certName <certName>
It is also possible to provide an alternative path for the root certificate (by defaul the root cert is expected in the same folder as the client cert). Param: caPath
node index.js --thingName <thingName> --certFolder <path/to/cert-folder> --certName <certName> --caPath certs/default/root-CA.crt