1008 unexpected data message: When using htmx client
- 主要语言
- Go
- 星标
- 5.5k
- 派生
- 372
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi,
I seem to be having issues using this library when using it htmx as the client, specifically version 2 of htmx. I am also testing this on Firefox (if browser may make a difference.
I tend to see either this error `Connection Closed: 1008 unexpected data message` or sometimes I see `Invalid RSV bits ...`.
I am not sure how to debug what is going on. But I noticed there was another issue where someone getting similar errors in issue #339.
I tried using another library, https://github.com/gobwas/ws, and it seems to work with this library :thinking:. See this commit here for an example where it works: https://gitlab.com/hmajid2301/banterbus/-/commit/a7501484832f51f430e83da1e39dacd01a0b6860.
See this commit here for a version with this library causing issues: https://gitlab.com/hmajid2301/banterbus/-/blob/9bcd9d73690df9cd3fdcddafc4498a1428497210/internal/transport/http.go
Please let me know if there is anything I can do to help :heart: .
## Reproduce
```bash
git clone https://gitlab.com/hmajid2301/banterbus.git
git checkout 9bcd9d73690df9cd3fdcddafc4498a1428497210
go run main.go
# Go to localhost:8080
```
- Try to submit the input `Create Room`
- Inspect network traffic
- Notice the error in the response
- Of the web socket request

## Version
```shell
cat go.mod
# ...
nhooyr.io/websocket v1.8.11
cat index.html
#
https://unpkg.com/htmx.org@2.0.0
https://unpkg.com/htmx-ext-ws@2.0.0/ws.js
firefox --version
Mozilla Firefox 128.0
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
使用 commit 9bcd9d73690df9cd3fdcddafc4498a1428497210 的 banterbus 仓库复现此问题,运行 `go run main.go`,并在使用 htmx 2.0 的 Firefox 中提交“Create Room”。首先阅读 internal/transport/http.go,并将其与正常工作的 gobwas/ws commit 进行比较。检查 WebSocket 网络响应,以隔离 1008 或 RSV 错误;当原因已确定且 htmx 复现能够正常工作,或已有明确的指导时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- go, javascript
- 领域
- backend, networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100