Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda