Ai
1 Star 0 Fork 0

毕升Office/go-socket.io

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fake_frame.go 646 Bytes
一键复制 编辑 原始数据 按行查看 历史
dan 提交于 2021-11-19 14:50 +08:00 . golang
package packet
import (
"bytes"
"gitee.com/ibisheng/go-socket.io/engineio/frame"
)
type fakeFrame struct {
w *fakeConnWriter
typ frame.Type
data *bytes.Buffer
}
func newFakeFrame(w *fakeConnWriter, fType frame.Type) *fakeFrame {
return &fakeFrame{
w: w,
typ: fType,
data: bytes.NewBuffer(nil),
}
}
func (w *fakeFrame) Write(p []byte) (int, error) {
return w.data.Write(p)
}
func (w *fakeFrame) Read(p []byte) (int, error) {
return w.data.Read(p)
}
func (w *fakeFrame) Close() error {
if w.w == nil {
return nil
}
w.w.Frames = append(w.w.Frames, Frame{
FType: w.typ,
Data: w.data.Bytes(),
})
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ibisheng/go-socket.io.git
git@gitee.com:ibisheng/go-socket.io.git
ibisheng
go-socket.io
go-socket.io
f22f23ac6ef8

搜索帮助