feat 初始化

This commit is contained in:
2026-10-29 10:12:22 +08:00
parent 332d812347
commit 09c1df8a22
81 changed files with 2211 additions and 7821 deletions

View File

@@ -4,12 +4,13 @@ import (
"bufio"
"bytes"
"errors"
"io"
"net/url"
"github.com/gobwas/ws"
"github.com/gobwas/ws/wsutil"
"github.com/panjf2000/gnet/v2"
"github.com/panjf2000/gnet/v2/pkg/logging"
"io"
"net/url"
)
// WSConn 实现ISocketConn接口
@@ -22,7 +23,7 @@ type WSConn struct {
isClose bool
param map[string]interface{}
openTime int64 // 开启连接的时间
remoteAddr string // 远程ID地址
remoteAddr string // 远程IP地址
wsMessageBuf
}
@@ -46,7 +47,7 @@ func (w *WSConn) readBytesBuf(c gnet.Conn) gnet.Action {
read, err := c.Read(buf)
if err != nil {
if w.logger != nil {
w.logger.Errorf("ws read bytes buf error", err)
w.logger.Errorf("ws read bytes buf error: %v", err)
}
return gnet.Close
}
@@ -132,7 +133,7 @@ func (w *WSConn) readWsMessages() (messages []wsutil.Message, err error) {
}
} else { //数据不完整
if w.logger != nil {
w.logger.Debugf("ws read ws message incomplete data", in.Len(), dataLen)
w.logger.Debugf("ws read ws message incomplete data ,%v,%v", in.Len(), dataLen)
}
return
}