Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
mqtt over websocket connection with aws iot core in reactjs

I'm making a real time dashboard for wind and solar farms approximately around 100 devices, and I'm having trouble with the data coming from aws iot mqtt websocket connection using amplify pubsub library documentation . I'm able to connect to the broker using mqtt over websockets but the data logs several times in the console when i receive the data. This is the code I am using

import Amplify, { PubSub } from "aws-amplify";
import { AWSIoTProvider } from "@aws-amplify/pubsub";
import { useEffect } from "react";
import { useState } from "react";
const DemoConnection = () => {
  Amplify.configure({
    Auth: {
      identityPoolId: "xxxxxx",
      region: "us-east-1",
    },
  });
  Amplify.addPluggable(
    new AWSIoTProvider({
      aws_pubsub_region: "us-east-1",
      aws_pubsub_endpoint:
        "wss://xxxxx.amazonaws.com/mqtt",
    })
  );

  PubSub.subscribe("myTopic", { provider: "AWSIoTProvider" }).subscribe({
    next: (data) => {
      console.log("Message received", data);

    },
    error: (error) => console.error(error),
    complete: () => console.log("Done"),
  });
  return null;
};
export default DemoConnection;

Please help me with the above problem

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!