fix: 按 K-00 约定修复 Go SDK 断线重交与退避
This commit is contained in:
+9
-4
@@ -73,6 +73,11 @@ func (c *Client) Directory(ctx context.Context, cursor, query string, limit int)
|
||||
|
||||
// WatchPresence 订阅上下线;ids 为空且 all 为 true 表示全部。
|
||||
func (c *Client) WatchPresence(ctx context.Context, ids []string, all bool) error {
|
||||
c.mu.Lock()
|
||||
c.watchIDs = append([]string(nil), ids...)
|
||||
c.watchAll = all
|
||||
c.watchSet = true
|
||||
c.mu.Unlock()
|
||||
req := map[string]any{"v": 1, "type": "presence.watch", "rid": c.nextRID(), "all": all}
|
||||
if len(ids) > 0 {
|
||||
req["ids"] = ids
|
||||
@@ -131,11 +136,11 @@ func (c *Client) ChangeLoginPassword(ctx context.Context, oldPassword, newPasswo
|
||||
if c.transport != nil {
|
||||
c.transport.SetCredential(d.SessionToken)
|
||||
}
|
||||
h := c.onSession
|
||||
tok := d.SessionToken
|
||||
c.mu.Unlock()
|
||||
if c.onSession != nil {
|
||||
c.cbMu.Lock()
|
||||
c.onSession(d.SessionToken)
|
||||
c.cbMu.Unlock()
|
||||
if h != nil {
|
||||
h(tok)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user