You are reading a single comment by @lukevanhorn and its replies. Click here to read the full conversation.
  • It works!

    I tried your suggestion of deleting the keys after initiating the connection.

    Updated code example:

    SPI3.setup({ mosi:B5, miso:B4, sck:B3 });
    var eth = require("WIZnet").connect(SPI3, A8);
    var options = url.parse("mqtt://­");
    options.key = atob("MIIEow ... d4/IvHs");
    options.cert = atob("MIIDWj ... +NrCQ=="); = atob("MIIE0z ... dao7WNq");
    var mqtt = require("MQTT").create();
    mqtt.on("connected", function() {
      console.log("connected to AWS IoT...");
    mqtt.on("publish", function (pub) {
      console.log("\r\nnew message received: ");
      console.log("topic: "+pub.topic);
      console.log("message: "+pub.message);
    require("tls").connect(options, function(res) {
      console.log("tls connected");
    delete options.key;
    delete options.cert;

    And the results:

    Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    Performing the SSL/TLS handshake...
    tls connected
    Client connected
    >Verifying peer X.509 certificate...
    MQTT connection accepted
    connected to AWS IoT...
    new message received:
    topic: test/topic
    message: hello world!

    The 'hello world' message was published from another client application.

    Exciting! Thanks for making this happen so quickly.


Avatar for lukevanhorn @lukevanhorn started