feat: conn update token

This commit is contained in:
Gordon 2023-07-03 21:30:22 +08:00
parent 1f94357498
commit 92f64ddf7c

View File

@ -53,6 +53,7 @@ type Client struct {
longConnServer LongConnServer longConnServer LongConnServer
closed bool closed bool
closedErr error closedErr error
token string
} }
func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client { func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
@ -65,7 +66,7 @@ func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
ctx: ctx, ctx: ctx,
} }
} }
func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isBackground, isCompress bool, longConnServer LongConnServer) { func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isBackground, isCompress bool, longConnServer LongConnServer, token string) {
c.w = new(sync.Mutex) c.w = new(sync.Mutex)
c.conn = conn c.conn = conn
c.PlatformID = utils.StringToInt(ctx.GetPlatformID()) c.PlatformID = utils.StringToInt(ctx.GetPlatformID())
@ -77,6 +78,7 @@ func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isBackground,
c.IsBackground = false c.IsBackground = false
c.closed = false c.closed = false
c.closedErr = nil c.closedErr = nil
c.token = token
} }
func (c *Client) pongHandler(_ string) error { func (c *Client) pongHandler(_ string) error {
c.conn.SetReadDeadline(pongWait) c.conn.SetReadDeadline(pongWait)