Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why android webView is not supporting webSocket?

In my application I am using webView to call a URL. My website is using web Socket to change values. when i open same URL in chrome application it's value changes it means web socket is working fine. But, inside webView value change is not happening. Is it mean web Socket is not supporting in webView widget. Where, I have noticed that WebViewClient's onLoadResource() method keeps calling infinite times.

like image 950
hannna patait Avatar asked Jan 26 '23 19:01

hannna patait


1 Answers

Web socket did not work because local storage is disabled by default.

Enabling it in my Android WebView solved the issue.

webView.getSettings().setDomStorageEnabled(true);
like image 114
hannna patait Avatar answered Jan 30 '23 11:01

hannna patait