WebSocket inside WebView?
See original GitHub issueIs there any reason a WebSocket wouldn’t work? I get crickets, while the same code works from the main RN app.
<WebView
originWhitelist={['*']}
injectedJavaScript={`
var exampleSocket = new WebSocket('ws://localhost:3000')
exampleSocket.onopen = function (event) {
window.ReactNativeWebView.postMessage("onopen")
}
exampleSocket.onerror = (e) => {
window.ReactNativeWebView.postMessage('onerror')
}
exampleSocket.onmessage = (e) => {
window.ReactNativeWebView.postMessage('onmessage')
}
`}
source={{ html: '<html><body></body></html>' }}
/>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
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...
Read more >Android – WebSocket in Android WebView - iTecNote
I used this project to demonstrate how to use PhoneGap with Pusher on Android but ultimately it's just a project that happens to...
Read more >WebSockets in WebView dropping/hanging (but not explicitly ...
Expected result: I have a web app that runs on websockets (SockJS) talking to a python backend. It works flawlessy in the browser...
Read more >WebSocket - Web APIs
Chrome Edge Internet Exp...
WebSocket Chrome Full support 4 Edge Full support 12 IE Full supp...
WebSocket() constructor. ⚠️ Chrome Full support Yes Edge Full...
Read more >Web Socket issue in Safari/WebView… - Apple Developer
Web Socket issue in Safari/WebView on iOS 15/macOS Monterey ... In our web app, we use the MQTT library which internally uses a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Would love to hear from a maintainer on this issue 😃
I am having the same issue.
If I open the webview url in my macbook chrome, server catches the socket connection.
But nothing hits the server when I open it on my RN webview…