You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require('dotenv').config()const{ Mqtt }=require('azure-iot-device-mqtt');const{ Client, Message }=require('azure-iot-device');/* My least important question, but interesting...why does the wrapping go transportObj : MessagEnqueued : transportObj??(havent really investigated... maybe take out)*/conststartMessageInterval=(client,messageDelay=3000)=>setInterval(async()=>{constasteroid={size : Math.random()*100,timeTillImpact : Math.random()*100}//leaving units to users imaginationconstmsg=newMessage(JSON.stringify(asteroid))msg.properties.add('IMPACT_EMERGENCY',asteroid.timeTillImpact<50&&asteroid.size>50 ? 'true' : 'false')consttransportObj=awaitclient.sendEvent(msg).catch(err=>console.error('Error sending message: ',err))console.log(transportObj)},messageDelay)construn=async()=>{try{//create a client using the device connection string and the mqtt protocolconstclient=Client.fromConnectionString(process.env.DEVICE_CONN_STRING,Mqtt)constsendMessageInterval=startMessageInterval(client)}catch(err){console.error('Error: ',err)}}run()
The text was updated successfully, but these errors were encountered:
per APerrine's notes:
To repro
The text was updated successfully, but these errors were encountered: