-
Notifications
You must be signed in to change notification settings - Fork 38.9k
extension api: port mapping for websockets not working #74085
Copy link
Copy link
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityhtmlHTML support issuesHTML support issueswebviewWebview issuesWebview issues
Description
The new port mapping API doesn't work for websockets, e.g.
http://localhost:3000 is mapped to http://localhost:4000
ws://localhost:3000 is not mapped to ws://localhost:4000
Steps to Reproduce:
// extension.js
const vscode = require('vscode')
const { createServer } = require('http')
createServer((req, res) => {
res.end('ok')
}).listen(4000)
const html = `<!doctype html>
<html>
<h1>hello world</h1>
<script>
fetch('http://localhost:3000')
new WebSocket('ws://localhost:3000')
</script>
</html>
`
exports.activate = () => {
const webViewPanel = vscode.window.createWebviewPanel(
'my-extension',
'my-extension',
{
viewColumn: 1,
},
{
enableScripts: true,
portMapping: [
{
extensionHostPort: 4000,
webviewPort: 3000,
},
],
}
)
webViewPanel.webview.html = html
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityhtmlHTML support issuesHTML support issueswebviewWebview issuesWebview issues
