Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
de52fd3ad2
|
@ -6,7 +6,6 @@ import (
|
|||
"encoding/json"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/id_generator"
|
||||
"fusenapi/utils/websocket_data"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
@ -37,8 +36,6 @@ func NewDataTransferLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Data
|
|||
}
|
||||
|
||||
var (
|
||||
//全局websocketid生成器
|
||||
websocketIdGenerator = id_generator.NewWebsocketId(1)
|
||||
//临时缓存对象池
|
||||
buffPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
|
@ -62,23 +59,23 @@ var (
|
|||
}
|
||||
//websocket连接存储
|
||||
mapConnPool = sync.Map{}
|
||||
//公共互斥锁
|
||||
//公共互斥锁(复用连接标识用)
|
||||
publicMutex sync.Mutex
|
||||
)
|
||||
|
||||
// 每个连接的连接基本属性
|
||||
type wsConnectItem struct {
|
||||
conn *websocket.Conn //websocket的连接
|
||||
logic *DataTransferLogic //logic
|
||||
closeChan chan struct{} //ws连接关闭chan
|
||||
isClose bool //是否已经关闭
|
||||
uniqueId string //ws连接唯一标识
|
||||
inChan chan []byte //接受消息缓冲通道
|
||||
outChan chan []byte //发送回客户端的消息
|
||||
mutex sync.Mutex //互斥锁
|
||||
userId int64 //用户id
|
||||
guestId int64 //游客id
|
||||
renderProperty renderProperty //扩展云渲染属性
|
||||
conn *websocket.Conn //websocket的连接(基本属性)
|
||||
logic *DataTransferLogic //logic(基本属性,用于获取上下文,配置或者操作数据库)
|
||||
closeChan chan struct{} //ws连接关闭chan(基本属性)
|
||||
isClose bool //是否已经关闭(基本属性)
|
||||
uniqueId string //ws连接唯一标识(基本属性)
|
||||
inChan chan []byte //接受消息缓冲通道(基本属性)
|
||||
outChan chan []byte //发送回客户端的消息(基本属性)
|
||||
mutex sync.Mutex //互斥锁(关闭连接方法中用)
|
||||
userId int64 //用户id(基本属性)
|
||||
guestId int64 //游客id(基本属性)
|
||||
renderProperty renderProperty //扩展云渲染属性(扩展属性)
|
||||
}
|
||||
|
||||
// 请求建立连接,升级websocket协议
|
||||
|
|
Loading…
Reference in New Issue
Block a user