refactor: replace LongConn with ClientConn interface and simplify message handling

This commit is contained in:
withchao
2025-12-19 15:53:17 +08:00
parent a1dd79a459
commit 9da7db2ac2
2 changed files with 13 additions and 0 deletions
+2
View File
@@ -68,6 +68,7 @@ type Client struct {
UserID string `json:"userID"`
IsBackground bool `json:"isBackground"`
SDKType string `json:"sdkType"`
SDKVersion string `json:"sdkVersion"`
Encoder Encoder
ctx *UserConnContext
longConnServer LongConnServer
@@ -95,6 +96,7 @@ func (c *Client) ResetClient(ctx *UserConnContext, conn ClientConn, longConnServ
c.closedErr = nil
c.token = ctx.GetToken()
c.SDKType = ctx.GetSDKType()
c.SDKVersion = ctx.GetSDKVersion()
c.hbCtx, c.hbCancel = context.WithCancel(c.ctx)
c.subLock = new(sync.Mutex)
if c.subUserIDs != nil {