coder / coder/code-server

[Feature Request] Intercepting hardcoded localhost WebSockets for HMR (.NET Hot Reload / dotnet watch)

未关闭
#7,976 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
TypeScript
星标
79.3k
派生
6.8k
平均合并
2 天 6 小时
30 天内合并 PR
41

描述

## What is your suggestion?
Implement a client-side interceptor or dynamic proxy mechanism within `code-server`'s browser context that can catch outbound WebSocket requests to `localhost:` and seamlessly route them through `code-server`'s built-in proxy layer back to the remote workspace.

## Why do you want this feature?
Developers relying on `code-server` for a pure browser-based development experience cannot use .NET's Hot Reload (`dotnet watch`).

When running `dotnet watch`, the .NET SDK dynamically injects a script (`aspnetcore-browser-refresh.js`) into the DOM that attempts to establish an HMR WebSocket connection to a random, ephemeral port on `localhost` (e.g., `ws://localhost:40777`).

Because the browser executes this locally, it queries the user's physical machine rather than the remote `code-server` container. The connection drops, and Hot Reload fails:
`Firefox can’t establish a connection to the server at ws://localhost:40777/`

Image

```
Firefox can’t establish a connection to the server at ws://localhost:43067/. aspnetcore-browser-refresh.js:318:25
WebSocket failed to connect. aspnetcore-browser-refresh.js:19:15
Firefox can’t establish a connection to the server at wss://localhost:33935/. aspnetcore-browser-refresh.js:318:25
WebSocket failed to connect. aspnetcore-browser-refresh.js:19:15
Unable to establish a connection to the browser refresh server. aspnetcore-browser-refresh.js:23:13
```

## Are there any workarounds to get this functionality today?
There are no workarounds for a **pure browser** workflow (e.g., coding on an iPad or a locked-down laptop without CLI access).

## Are you interested in submitting a PR for this?
No, I do not have the familiarity with the `code-server` networking/proxy codebase to implement this reliably.

贡献指南

打开贡献指南

调研方向

The payload names no code-server files or tests. Start by tracing browser-context handling of outbound localhost WebSockets and the built-in proxy layer, then examine how the injected aspnetcore-browser-refresh.js uses ephemeral ws/wss ports. Done should be a pure-browser dotnet watch workflow where Hot Reload connects through code-server without localhost failures.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
devtools, networking
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。