Invalid WebSocket url in a Chrome extension context
See original GitHub issue- Operating System: Windows 10
- Node Version: 12.18.2
- NPM Version: 6.14.5
- webpack Version: 4.44.1
- webpack-dev-server Version: 3.11.0
- Browser: Chrome 85.0.4183.121
- This is a bug
- This is a modification request
Code
Expected Behavior
Webpack dev server transportMode: 'ws'
should work as expected when loaded inside a context of a Chrome extension popup.
Actual Behavior
Webpack dev server transportMode: 'ws'
throws an error that the url is not valid. The problem is with this line of code
_this.client = new WebSocket(url.replace(/^http/, 'ws'));
found in WebsocketClient.js
It assumes that the protocol will be one of http:
/https:
, but in chrome extension popup it’s actually chrome-extension:
For Bugs; How can we reproduce the behavior?
Set the transportMode: 'ws'
config to the dev server, and use it to serve a browser extension popup
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Implement websocket in chrome extension - Stack Overflow
I implemented the websockets in the background.js . Following is the code: function createWebSocketConnection ...
Read more >chrome.webRequest - Chrome Developers
A CORS preflight for a request URL is visible to an extension if there is a ... the webRequest API supports intercepting the...
Read more >Downloads - ChromeDriver - WebDriver for Chrome
Fixed navigation to malformed URL to return "invalid argument" error; Fixed HTTP status code when invalid session id is received; Fixed error response...
Read more >Use case for persistent background scripts & other concerns
The implication of this is that our desktop app needs to tell our Chrome extension "hey, the device is still in range!" regularly...
Read more >ServiceWorker is shut down every 5 minutes for manifest V3 ...
I'm affected by this issue for my private chrome extension in which I want to keep a websocket (socketio) connection alive in my...
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 Free
Top 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
Possibly fixed in
master
via #2954. Could you test it?I got it in a big project, I’ll try to reproduce it in a minimal repo 👍