Are there any plans to implement prepared writes?
- 主要言語
- Go
- スター
- 5.5k
- フォーク
- 372
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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](https://github.com/gorilla/websocket) and [lxzan/gws](https://github.com/lxzan/gws/tree/main)). 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.
```Go
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)
}
}
````
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、ライブラリに既存の websocket.Conn の書き込み API と、提案されている PrepareMessage および WritePrepared のエントリポイントを確認し、次に引用されている gorilla/websocket と lxzan/gws の動作を比較してください。実装前に、API、圧縮との相互作用、メッセージのライフサイクルを確立してください。完了とは、同一のブロードキャストに対する再利用をサポートする、合意済みの設計ができている状態です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- go
- 領域
- backend-api-design, networking
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100