You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//【1】: When user logined im and im runs works right (in android application)
//【2】: App runs in background or screen lock situation
//【3】: heart beat in android client blocked and sendPingToServer() never involved
`func (c *LongConnMgr) heartbeat(ctx context.Context) {
log.ZDebug(ctx, "heartbeat start", "goroutine ID:", getGoroutineID())
ticker := time.NewTicker(pingPeriod)
defer func() {
ticker.Stop()
log.ZWarn(c.ctx, "heartbeat closed", nil, "heartbeat", "heartbeat done sdk logout.....")
}()
for {
select {
case <-ctx.Done():
log.ZInfo(ctx, "heartbeat done sdk logout.....")
return
case <-c.heartbeatCh:
c.sendPingToServer(ctx)
case <-ticker.C:
c.sendPingToServer(ctx) //██ Blocked Here 🆕🆕🆕
}
}
}`
//【4】Server will never receive ping from client every 30 seconds
//【5】Server will close this connection becouse heart beat failed from client
//【6】Client will receive 10006 error and reconnect to server
//【7】above progress will repeat every 30 seconds
//██ the result is when app in background, the reconnect progress will repeat every 30s. Server will consume lots of resources.
What did you expect to happen?
When client in background, the heartbeat can work right. On the other word, CODE_1 will still work when client in bacground.
How can we reproduce it (as minimally and precisely as possible)?
App runs in background or screen lock situation
Anything else we need to know?
No response
version
```console
$ {name} 3.4.1
# paste output here
```
Cloud provider
//【】
OS version
```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```
Install tools
The text was updated successfully, but these errors were encountered:
kubbot
changed the title
Bug: <Heart beat not working in Android when applicaiton in backgroung>
Bug: <Heartbeat not working in Android when application in background>
Mar 23, 2024
What happened?
//【1】: When user logined im and im runs works right (in android application)
//【2】: App runs in background or screen lock situation
//【3】: heart beat in android client blocked and sendPingToServer() never involved
`func (c *LongConnMgr) heartbeat(ctx context.Context) {
log.ZDebug(ctx, "heartbeat start", "goroutine ID:", getGoroutineID())
ticker := time.NewTicker(pingPeriod)
defer func() {
ticker.Stop()
log.ZWarn(c.ctx, "heartbeat closed", nil, "heartbeat", "heartbeat done sdk logout.....")
}()
for {
select {
case <-ctx.Done():
log.ZInfo(ctx, "heartbeat done sdk logout.....")
return
case <-c.heartbeatCh:
c.sendPingToServer(ctx)
case <-ticker.C:
c.sendPingToServer(ctx) //██ Blocked Here 🆕🆕🆕
}
}
}`
//【4】Server will never receive ping from client every 30 seconds
//【5】Server will close this connection becouse heart beat failed from client
//【6】Client will receive 10006 error and reconnect to server
//【7】above progress will repeat every 30 seconds
//██ the result is when app in background, the reconnect progress will repeat every 30s. Server will consume lots of resources.
What did you expect to happen?
When client in background, the heartbeat can work right. On the other word, CODE_1 will still work when client in bacground.
`func (c *LongConnMgr) heartbeat(ctx context.Context) {
log.ZDebug(ctx, "heartbeat start", "goroutine ID:", getGoroutineID())
ticker := time.NewTicker(pingPeriod)
defer func() {
ticker.Stop()
log.ZWarn(c.ctx, "heartbeat closed", nil, "heartbeat", "heartbeat done sdk logout.....")
}()
for {
select {
case <-ctx.Done():
log.ZInfo(ctx, "heartbeat done sdk logout.....")
return
case <-c.heartbeatCh:
c.sendPingToServer(ctx)
case <-ticker.C:
c.sendPingToServer(ctx) //██ CODE_1
}
}
}`
How can we reproduce it (as minimally and precisely as possible)?
App runs in background or screen lock situation
Anything else we need to know?
No response
version
Cloud provider
OS version
Install tools
The text was updated successfully, but these errors were encountered: