0

all similiar questions are already a few years ago so I might ask again:

I made a website which includes the Paho.MQTT javascript client (mqttws31.js). It works fine on all browsers (also in Chrome on Android).

Here's my code:

var client = new Paho.MQTT.Client("ws://iot.eclipse.org/ws", "myClientId" + new Date().getTime());

This part doesn't work in a native android app within a WebView.

Are WebSockets not supported in general or is it a Paho.MQTT problem? Is there a fast and easy work-around? Some parts of my website are using SignalR - which works fine in a WebView...

Thanks!

MariusK
  • 537
  • 5
  • 20

1 Answers1

1

figured it out....

var client = new Paho.MQTT.Client("ws://iot.eclipse.org/ws", "myClientId");

did not work because local storage is disabled by default.

Enabling it in my Android WebView solved the issue. _mWebView.getSettings().setDomStorageEnabled(true);

MariusK
  • 537
  • 5
  • 20
  • I'm having this same issue in 2023 - mqtt with paho js web client works fine on pc, but android chrome and apple the client.send() never sends anything – Jammo Apr 03 '23 at 17:46