mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-25 04:32:10 +08:00
Merge fbec09df13a0ba5057b4830e989736341b496b7f into 11358404f9e6bfb15bc62445cedeefbad9bd342c
This commit is contained in:
commit
e375d4df42
@ -70,6 +70,7 @@ type Client struct {
|
|||||||
UserID string `json:"userID"`
|
UserID string `json:"userID"`
|
||||||
IsBackground bool `json:"isBackground"`
|
IsBackground bool `json:"isBackground"`
|
||||||
SDKType string `json:"sdkType"`
|
SDKType string `json:"sdkType"`
|
||||||
|
SDKVersion string `json:"sdkVersion"`
|
||||||
Encoder Encoder
|
Encoder Encoder
|
||||||
ctx *UserConnContext
|
ctx *UserConnContext
|
||||||
longConnServer LongConnServer
|
longConnServer LongConnServer
|
||||||
@ -97,6 +98,7 @@ func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, longConnServer
|
|||||||
c.closedErr = nil
|
c.closedErr = nil
|
||||||
c.token = ctx.GetToken()
|
c.token = ctx.GetToken()
|
||||||
c.SDKType = ctx.GetSDKType()
|
c.SDKType = ctx.GetSDKType()
|
||||||
|
c.SDKVersion = ctx.GetSDKVersion()
|
||||||
c.hbCtx, c.hbCancel = context.WithCancel(c.ctx)
|
c.hbCtx, c.hbCancel = context.WithCancel(c.ctx)
|
||||||
c.subLock = new(sync.Mutex)
|
c.subLock = new(sync.Mutex)
|
||||||
if c.subUserIDs != nil {
|
if c.subUserIDs != nil {
|
||||||
|
|||||||
@ -28,6 +28,7 @@ const (
|
|||||||
BackgroundStatus = "isBackground"
|
BackgroundStatus = "isBackground"
|
||||||
SendResponse = "isMsgResp"
|
SendResponse = "isMsgResp"
|
||||||
SDKType = "sdkType"
|
SDKType = "sdkType"
|
||||||
|
SDKVersion = "sdkVersion"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@ -15,12 +15,13 @@
|
|||||||
package msggateway
|
package msggateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
|
||||||
|
|
||||||
"github.com/openimsdk/protocol/constant"
|
"github.com/openimsdk/protocol/constant"
|
||||||
"github.com/openimsdk/tools/utils/encrypt"
|
"github.com/openimsdk/tools/utils/encrypt"
|
||||||
"github.com/openimsdk/tools/utils/stringutil"
|
"github.com/openimsdk/tools/utils/stringutil"
|
||||||
@ -140,6 +141,10 @@ func (c *UserConnContext) GetToken() string {
|
|||||||
return c.Req.URL.Query().Get(Token)
|
return c.Req.URL.Query().Get(Token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *UserConnContext) GetSDKVersion() string {
|
||||||
|
return c.Req.URL.Query().Get(SDKVersion)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *UserConnContext) GetCompression() bool {
|
func (c *UserConnContext) GetCompression() bool {
|
||||||
compression, exists := c.Query(Compression)
|
compression, exists := c.Query(Compression)
|
||||||
if exists && compression == GzipCompressionProtocol {
|
if exists && compression == GzipCompressionProtocol {
|
||||||
|
|||||||
@ -254,6 +254,10 @@ func (ws *WsServer) registerClient(client *Client) {
|
|||||||
oldClients []*Client
|
oldClients []*Client
|
||||||
)
|
)
|
||||||
oldClients, userOK, clientOK = ws.clients.Get(client.UserID, client.PlatformID)
|
oldClients, userOK, clientOK = ws.clients.Get(client.UserID, client.PlatformID)
|
||||||
|
|
||||||
|
log.ZInfo(client.ctx, "registerClient", "userID", client.UserID, "platformID", client.PlatformID,
|
||||||
|
"sdkVersion", client.SDKVersion)
|
||||||
|
|
||||||
if !userOK {
|
if !userOK {
|
||||||
ws.clients.Set(client.UserID, client)
|
ws.clients.Set(client.UserID, client)
|
||||||
log.ZDebug(client.ctx, "user not exist", "userID", client.UserID, "platformID", client.PlatformID)
|
log.ZDebug(client.ctx, "user not exist", "userID", client.UserID, "platformID", client.PlatformID)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user