5

I am using this URL from Ajax “https://username:password@home.myopenhab.org/rest/events?topics=smarthome/" to get SSE(Server Sent Events) in client side application from server using Cordova.

  • Its working fine on IOS but its not working on android
  • (I am using android 7.0, latest chrome version and also enabled the webview implementation in developer options).
  • for same URL if I give IP like "http://192.168.0.1/rest/events?topics=smarthome/” its working fine on both IOS and android.

Note:Both URL(“https://username:password@home.myopenhab.org/rest/events?topics=smarthome/" AND "http://192.168.0.1/rest/events?topics=smarthome/”), working fine with the "cordova-crosswalk-plugin" but i dont want to use crosswalk plugin beacuse asking for download some dependency application from google play.

var eventSource = new EventSource(" +“url”+ /rest/events?topics=smarthome/*");   

eventSource.addEventListener(‘message’, function (eventPayload){

//not entering here.

}

1 Answers1

0

I found the answer here, I'll say it here:

Reason is your URL use https

You can try remove onReceivedSslError method in \cordova\platforms\android\CordovaLib\src\org\apache\cordova\ CordovaWebViewClient.java

then add handler.proceed()

mducc
  • 743
  • 1
  • 9
  • 32
  • 2
    hello , thank you for your reply.. their is no file called CordovaWebViewClient.java in mentioned path. I found SystemWebViewClient.java in \cordova\platforms\android\CordovaLib\src\org\apache\cordova\engine path i have changed the handler.proceed() in else part but its not working... – paramesh surakod Dec 03 '18 at 07:45
  • I am using cordova 8.1.2 – paramesh surakod Dec 03 '18 at 07:52