function check() {
  const url = "ws://"+broker.value
  // test connection
  var client  = mqtt.connect(url, {keepalive:0, reconnectPeriod:0 });

  client.on('connect', function () {
    connectstatus.className="connected";
    connectstatus.textContent="connected";
  })
  
  client.on('error', function () {
    connectstatus.className="notconnected";
    connectstatus.textContent="not connected";
  })
}
// check if the current broker is pingable
check if the current broker is pingable
check if the current broker is pingable
function check() {
  const url = "ws://"+broker.value
  var client  = mqtt.connect(url, {keepalive:0, reconnectPeriod:0 });
  client.on('connect', function () {
    connectstatus.className="connected";
    connectstatus.textContent="connected";
  })
  client.on('error', function () {
    connectstatus.className="notconnected";
    connectstatus.textContent="not connected";
  })
}
function check ( ) { const url = "ws://" + broker . value var client = mqtt . connect ( url , { keepalive : 0 , reconnectPeriod : 0 } ) ; client . on ( 'connect' , function ( ) { connectstatus . className = "connected" ; connectstatus . textContent = "connected" ; } ) client . on ( 'error' , function ( ) { connectstatus . className = "notconnected" ; connectstatus . textContent = "not connected" ; } ) }
check if the current broker is pingable
check if the current broker is pingable
// test connection