0

I am using this cordova plugin : https://github.com/HeimgardTechnologiesAS/cordova-plugin-advanced-websocket#readme android platform 8.1.0 but can not get work this is js code :

   document.addEventListener('deviceready', function () {

  var wsOptions = {
    url: "ws://192.168.0.18:4233",
    timeout: 5000,
    pingInterval: 10000,

    acceptAllCerts: false
  }

  CordovaWebsocketPlugin.wsConnect(wsOptions,
    function (recvEvent) {
      alert("Received callback from WebSocket: " + recvEvent["callbackMethod"]);
    },
    function (success) {
      alert("Connected to WebSocket with id: " + success.webSocketId);
    },
    function (error) {
      alert("Failed to connect to WebSocket: " +
        "code: " + error["code"] +
        ", reason: " + error["reason"] +
        ", exception: " + error["exception"]);
    }
  );


}, false);

I got this error : Failed to connect to Websocket: code: 1006, reason: undefiened, exception: CLEARTEXT communication to 192.168.0.18 not permitted by network security policy

Smarta
  • 1
  • 3
  • Does this answer your question? [Why am I seeing net::ERR\_CLEARTEXT\_NOT\_PERMITTED errors after upgrading to Cordova Android 8?](https://stackoverflow.com/questions/54752716/why-am-i-seeing-neterr-cleartext-not-permitted-errors-after-upgrading-to-cordo) – Eric Jan 07 '22 at 12:47

0 Answers0