feat 初始化
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user