I am using this URL from Ajax “https://username:[email protected]/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:[email protected]/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.
}
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()