Are there any plans to implement prepared writes?
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- go
调研方向
首先审查库中现有的 websocket.Conn 写入 API 以及提议的 PrepareMessage 和 WritePrepared 入口点,然后比较所引用的 gorilla/websocket 和 lxzan/gws 的行为。在实现之前确定 API、压缩交互和消息生命周期;完成的标准是形成一个支持对相同广播进行复用的已达成一致的设计。
由索引模型根据 Issue 内容生成。
描述
I'm currently working on a websocket-based broadcasting server and would be more then happy to use this great library, but there is no prepared writes functionality, like in some other websocket libraries (e.g. gorilla/websocket and lxzan/gws). This would help a lot to optimize the broadcasting of identical messages. Are there any plans to implement this feature in some way (or accept PRs that implements it)?
I'm not sure how the API should look like, but it would be cool to have something similar.
var connections []*websocket.Conn
// Create prepared message without frames generation.
pm := websocket.PrepareMessage(websocket.MessageText, []byte("hello"))
defer pm.Close()
for _, c := range connections {
// Lazily initialize frame buffer for "pm" and reuse it for other connections.
// For each set of compression settings (mode and threshold), there will be separate pre-initialized frame
// buffers, so if some connections don't have compression enabled and some do have, then two types of
// frame buffers will be initialized for each of them.
if err := c.WritePrepared(ctx, pm); err != nil {
log.Printf("failed to write prepared message: %v\n", err)
}
}
- 主要语言
- Go
- 星标
- 5.5k
- 派生
- 377
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/websocket 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
export wstest未关闭enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 42/100
-
难度 5/5 一周以上 新手友好度 45/100
相似的 Issue
-
priority: low 🌱 type: enhancement 💅🏼
难度 2/5 半天 新手友好度 84/100
nebari-dev/llm-serving-pack#199 ·
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
-
area/helm kind/bug priority/backlog triage/accepted
难度 2/5 1-3 小时 新手友好度 84/100
lexfrei/cloudflare-tunnel-gateway-controller#889 ·
维护者通常 1 天内回复
-
bug difficulty: beginner documentation good first issue help wanted localization
难度 1/5 1 小时以内 新手友好度 90/100
wavefnd/wave-platform#140 ·
-
compiler/runtime
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复