Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 断开连接然后重新启动Internet连接后Firebase实时数据库未连接_Android_Firebase_Firebase Realtime Database - Fatal编程技术网

Android 断开连接然后重新启动Internet连接后Firebase实时数据库未连接

Android 断开连接然后重新启动Internet连接后Firebase实时数据库未连接,android,firebase,firebase-realtime-database,Android,Firebase,Firebase Realtime Database,在我的应用程序中,在单击某个按钮的某个点,应用程序需要在RTDB上执行操作(具体地说,检查节点的存在)。为了确保用户在未连接到网络时收到警告,我正在进行类似的检查 private fun checkNet():布尔值{ val cm=context?.getSystemService(context.CONNECTIVITY_服务)作为ConnectionManager val netC=cm.getNetworkCapabilities(cm.activeNetwork) 返回( netC!=

在我的应用程序中,在单击某个按钮的某个点,应用程序需要在RTDB上执行操作(具体地说,检查节点的存在)。为了确保用户在未连接到网络时收到警告,我正在进行类似的检查

private fun checkNet():布尔值{
val cm=context?.getSystemService(context.CONNECTIVITY_服务)作为ConnectionManager
val netC=cm.getNetworkCapabilities(cm.activeNetwork)
返回(
netC!=null&&
netC.hascability(NetworkCapabilities.NET\u CAPABILITY\u INTERNET)&&
netC.hascability(NetworkCapabilities.NET\u CAPABILITY\u验证)&&
(网络传输(网络能力传输)||
netC.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))
)
}
然后在必要时调用该函数

但我面临的问题是,如果internet连接丢失后又恢复,那么即使连接了侦听器,它也不会连接到服务器。我意识到这需要时间,但是连接到
.info/connected
位置的侦听器在连接到该位置时从不触发

override-fun-onStop(){
super.onStop()
Firebase.database.getReference(“.info/connected”).removeEventListener(侦听器)
}
覆盖有趣的onStart(){
super.onStart()
Firebase.database.getReference(“.info/connected”).addValueEventListener(listener)
}
对象侦听器:ValueEventListener{
override fun onCancelled(错误:DatabaseError)=单位
覆盖数据更改(快照:DataSnapshot){
val isCon=if(snapshot.value!=null)snapshot.value为布尔值
否则错误
if(isCon)Log.d(标记“connected”.err())
else Log.d(标记“not connected”.err())
}
}
即使通过离开应用程序并返回应用程序触发了
onStart()
,侦听器也不会记录
已连接的
。只有当我关闭整个应用程序,然后重新打开它时,它才会连接

因此,我的问题是,我是否假设
.info/connected
的行为是正确的,如果是,那么我该怎么做才能确保它在存在internet连接的情况下在合理的时间段后连接到RTDB

编辑-正如@FrankVanPuffelen所建议的,我继续并启用了调试日志记录。在导航到片段并在存在internet连接的情况下访问数据库后,日志输出被删除

2020-07-03 15:58:50.167 com.example.paylater D/PersistentConnection: pc_0 - Listening on sellers/2 (params: {})
2020-07-03 15:58:50.167 com.example.paylater D/PersistentConnection: pc_0 - Adding listen query: sellers/2 (params: {})
2020-07-03 15:58:50.167 com.example.paylater D/Connection: conn_0 - Sending data: {t=d, d={a=q, r=20, b={p=sellers/2, h=}}}
2020-07-03 15:58:50.167 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 41278
2020-07-03 15:58:50.588 com.example.paylater D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":20,"b":{"s":"ok","d":{}}}}
2020-07-03 15:58:50.589 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44578
2020-07-03 15:58:50.589 com.example.paylater D/WebSocket: ws_0 - HandleNewFrameCount: 1
2020-07-03 15:58:50.590 com.example.paylater D/WebSocket: ws_0 - handleIncomingFrame complete frame: {t=d, d={r=20, b={d={}, s=ok}}}
2020-07-03 15:58:50.590 com.example.paylater D/Connection: conn_0 - received data message: {r=20, b={d={}, s=ok}}
2020-07-03 15:58:50.591 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 15:58:50.591 com.example.paylater D/EventRaiser: Raising /sellers/2: VALUE: null
2020-07-03 15:58:50.620 com.example.paylater D/PersistentConnection: pc_0 - unlistening on sellers/2 (params: {})
2020-07-03 15:58:50.620 com.example.paylater D/PersistentConnection: pc_0 - removing query sellers/2 (params: {})
2020-07-03 15:58:50.620 com.example.paylater D/Connection: conn_0 - Sending data: {t=d, d={a=n, r=21, b={p=sellers/2}}}
2020-07-03 15:58:50.621 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44968
2020-07-03 15:58:51.228 com.example.paylater D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":21,"b":{"s":"ok","d":""}}}
2020-07-03 15:58:51.228 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44392
2020-07-03 15:58:51.228 com.example.paylater D/WebSocket: ws_0 - HandleNewFrameCount: 1
2020-07-03 15:58:51.229 com.example.paylater D/WebSocket: ws_0 - handleIncomingFrame complete frame: {t=d, d={r=21, b={d=, s=ok}}}
2020-07-03 15:58:51.229 com.example.paylater D/Connection: conn_0 - received data message: {r=21, b={d=, s=ok}}
2020-07-03 15:59:30.260 com.example.paylater D/PersistentConnection: pc_0 - Listening on sellers/2 (params: {})
2020-07-03 15:59:30.261 com.example.paylater D/PersistentConnection: pc_0 - Adding listen query: sellers/2 (params: {})
2020-07-03 15:59:30.262 com.example.paylater D/Connection: conn_0 - Sending data: {t=d, d={a=q, r=22, b={p=sellers/2, h=}}}
2020-07-03 15:59:30.263 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 5965
2020-07-03 16:00:15.263 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 0
2020-07-03 16:00:51.226 com.example.paylater D/WebSocket: ws_0 - WebSocket reached EOF.
2020-07-03 16:00:51.226 com.example.paylater D/WebSocket: ws_0 - closing itself
2020-07-03 16:00:51.226 com.example.paylater D/Connection: conn_0 - Realtime connection lost
2020-07-03 16:00:51.226 com.example.paylater D/Connection: conn_0 - closing realtime connection
2020-07-03 16:00:51.226 com.example.paylater D/PersistentConnection: pc_0 - Got on disconnect due to OTHER
2020-07-03 16:00:51.226 com.example.paylater D/PersistentConnection: pc_0 - Scheduling connection attempt
2020-07-03 16:00:51.226 com.example.paylater D/ConnectionRetryHelper: Scheduling retry in 0ms
2020-07-03 16:00:51.227 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 16:00:51.227 com.example.paylater D/EventRaiser: Raising /.info/connected: VALUE: false
2020-07-03 16:00:51.227 com.example.paylater D/PersistentConnection: pc_0 - Trying to fetch auth token
2020-07-03 16:00:51.229 com.example.paylater D/WebSocket: ws_0 - WebSocket error.
    com.google.firebase.database.tubesock.WebSocketException: IO Exception
        at com.google.firebase.database.tubesock.WebSocketWriter.runWriter(WebSocketWriter.java:159)
        at com.google.firebase.database.tubesock.WebSocketWriter.access$000(WebSocketWriter.java:30)
        at com.google.firebase.database.tubesock.WebSocketWriter$1.run(WebSocketWriter.java:47)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.net.SocketException: Socket is closed
        at com.android.org.conscrypt.AbstractConscryptSocket.checkOpen(AbstractConscryptSocket.java:581)
        at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(ConscryptFileDescriptorSocket.java:609)
        at java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:453)
        at com.google.firebase.database.tubesock.WebSocketWriter.writeMessage(WebSocketWriter.java:138)
        at com.google.firebase.database.tubesock.WebSocketWriter.runWriter(WebSocketWriter.java:152)
        at com.google.firebase.database.tubesock.WebSocketWriter.access$000(WebSocketWriter.java:30) 
        at com.google.firebase.database.tubesock.WebSocketWriter$1.run(WebSocketWriter.java:47) 
        at java.lang.Thread.run(Thread.java:919) 
2020-07-03 16:00:51.229 com.example.paylater D/PersistentConnection: pc_0 - Successfully fetched token, opening connection
2020-07-03 16:00:51.230 com.example.paylater D/Connection: conn_1 - Opening a connection
2020-07-03 16:00:51.233 com.example.paylater D/WebSocket: ws_0 - closed
2020-07-03 16:00:52.825 com.example.paylater D/WebSocket: ws_1 - websocket opened
2020-07-03 16:00:52.825 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive
2020-07-03 16:00:52.826 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"c","d":{"t":"h","d":{"ts":1593772513254,"v":"5","h":"s-usc1c-nss-203.firebaseio.com","s":"QMthzsHOAtBUR6Q05YGUpSKLJIeW1z6J"}}}
2020-07-03 16:00:52.826 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44998
2020-07-03 16:00:52.826 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:52.827 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=c, d={t=h, d={h=s-usc1c-nss-203.firebaseio.com, s=QMthzsHOAtBUR6Q05YGUpSKLJIeW1z6J, v=5, ts=1593772513254}}}
2020-07-03 16:00:52.827 com.example.paylater D/Connection: conn_1 - Got control message: {t=h, d={h=s-usc1c-nss-203.firebaseio.com, s=QMthzsHOAtBUR6Q05YGUpSKLJIeW1z6J, v=5, ts=1593772513254}}
2020-07-03 16:00:52.827 com.example.paylater D/Connection: conn_1 - realtime connection established
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - onReady
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - handling timestamp
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - calling restore state
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - Restoring auth.
2020-07-03 16:00:52.827 com.example.paylater D/Connection: conn_1 - Sending data (contents hidden)
2020-07-03 16:00:52.827 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44998
2020-07-03 16:00:52.828 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 16:00:52.829 com.example.paylater D/EventRaiser: Raising /.info/connected: VALUE: true
2020-07-03 16:00:53.466 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"d","d":{"r":23,"b":{"s":"ok","d":{"auth":{"name":"Yash Singh","email_verified":false,"provider":"password","email":"yashsingh.real@gmail.com","user_id":"QBO65tn5qLVN8zyVB2uMA8UByJ02","token":{"name":"Yash Singh","email_verified":false,"email":"yashsingh.real@gmail.com","exp":1593775621,"user_id":"QBO65tn5qLVN8zyVB2uMA8UByJ02","iat":1593772021,"sub":"QBO65tn5qLVN8zyVB2uMA8UByJ02","aud":"the-creditinator","auth_time":1592475916,"iss":"https://securetoken.google.com/the-creditinator","firebase":{"identities":{"email":["yashsingh.real@gmail.com"]},"sign_in_provider":"password"}},"uid":"QBO65tn5qLVN8zyVB2uMA8UByJ02"},"expires":1593775621}}}}
2020-07-03 16:00:53.467 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44360
2020-07-03 16:00:53.467 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:53.467 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=d, d={r=23, b={d={auth={uid=QBO65tn5qLVN8zyVB2uMA8UByJ02, email_verified=false, provider=password, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, name=Yash Singh, email=yashsingh.real@gmail.com, token={sub=QBO65tn5qLVN8zyVB2uMA8UByJ02, aud=the-creditinator, email_verified=false, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, auth_time=1592475916, name=Yash Singh, iss=https://securetoken.google.com/the-creditinator, exp=1593775621, firebase={sign_in_provider=password, identities={email=[yashsingh.real@gmail.com]}}, iat=1593772021, email=yashsingh.real@gmail.com}}, expires=1593775621}, s=ok}}}
2020-07-03 16:00:53.468 com.example.paylater D/Connection: conn_1 - received data message: {r=23, b={d={auth={uid=QBO65tn5qLVN8zyVB2uMA8UByJ02, email_verified=false, provider=password, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, name=Yash Singh, email=yashsingh.real@gmail.com, token={sub=QBO65tn5qLVN8zyVB2uMA8UByJ02, aud=the-creditinator, email_verified=false, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, auth_time=1592475916, name=Yash Singh, iss=https://securetoken.google.com/the-creditinator, exp=1593775621, firebase={sign_in_provider=password, identities={email=[yashsingh.real@gmail.com]}}, iat=1593772021, email=yashsingh.real@gmail.com}}, expires=1593775621}, s=ok}}
2020-07-03 16:00:53.468 com.example.paylater D/PersistentConnection: pc_0 - Restoring outstanding listens
2020-07-03 16:00:53.468 com.example.paylater D/PersistentConnection: pc_0 - Restoring listen sellers/2 (params: {})
2020-07-03 16:00:53.468 com.example.paylater D/Connection: conn_1 - Sending data: {t=d, d={a=q, r=24, b={p=sellers/2, h=}}}
2020-07-03 16:00:53.469 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44997
2020-07-03 16:00:53.471 com.example.paylater D/PersistentConnection: pc_0 - Restoring writes.
2020-07-03 16:00:54.105 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"d","d":{"r":24,"b":{"s":"ok","d":{}}}}
2020-07-03 16:00:54.105 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44364
2020-07-03 16:00:54.106 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:54.106 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=d, d={r=24, b={d={}, s=ok}}}
2020-07-03 16:00:54.106 com.example.paylater D/Connection: conn_1 - received data message: {r=24, b={d={}, s=ok}}
2020-07-03 16:00:54.106 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 16:00:54.107 com.example.paylater D/EventRaiser: Raising /sellers/2: VALUE: null
2020-07-03 16:00:54.107 com.example.paylater D/PersistentConnection: pc_0 - unlistening on sellers/2 (params: {})
2020-07-03 16:00:54.107 com.example.paylater D/PersistentConnection: pc_0 - removing query sellers/2 (params: {})
2020-07-03 16:00:54.108 com.example.paylater D/Connection: conn_1 - Sending data: {t=d, d={a=n, r=25, b={p=sellers/2}}}
2020-07-03 16:00:54.108 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44997
2020-07-03 16:00:54.632 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"d","d":{"r":25,"b":{"s":"ok","d":""}}}
2020-07-03 16:00:54.633 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44474
2020-07-03 16:00:54.633 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:54.633 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=d, d={r=25, b={d=, s=ok}}}
2020-07-03 16:00:54.633 com.example.paylater D/Connection: conn_1 - received data message: {r=25, b={d=, s=ok}}
禁用移动数据30秒后,再启用它并再次访问RTDB,输出为

2020-07-03 15:58:50.167 com.example.paylater D/PersistentConnection: pc_0 - Listening on sellers/2 (params: {})
2020-07-03 15:58:50.167 com.example.paylater D/PersistentConnection: pc_0 - Adding listen query: sellers/2 (params: {})
2020-07-03 15:58:50.167 com.example.paylater D/Connection: conn_0 - Sending data: {t=d, d={a=q, r=20, b={p=sellers/2, h=}}}
2020-07-03 15:58:50.167 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 41278
2020-07-03 15:58:50.588 com.example.paylater D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":20,"b":{"s":"ok","d":{}}}}
2020-07-03 15:58:50.589 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44578
2020-07-03 15:58:50.589 com.example.paylater D/WebSocket: ws_0 - HandleNewFrameCount: 1
2020-07-03 15:58:50.590 com.example.paylater D/WebSocket: ws_0 - handleIncomingFrame complete frame: {t=d, d={r=20, b={d={}, s=ok}}}
2020-07-03 15:58:50.590 com.example.paylater D/Connection: conn_0 - received data message: {r=20, b={d={}, s=ok}}
2020-07-03 15:58:50.591 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 15:58:50.591 com.example.paylater D/EventRaiser: Raising /sellers/2: VALUE: null
2020-07-03 15:58:50.620 com.example.paylater D/PersistentConnection: pc_0 - unlistening on sellers/2 (params: {})
2020-07-03 15:58:50.620 com.example.paylater D/PersistentConnection: pc_0 - removing query sellers/2 (params: {})
2020-07-03 15:58:50.620 com.example.paylater D/Connection: conn_0 - Sending data: {t=d, d={a=n, r=21, b={p=sellers/2}}}
2020-07-03 15:58:50.621 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44968
2020-07-03 15:58:51.228 com.example.paylater D/WebSocket: ws_0 - ws message: {"t":"d","d":{"r":21,"b":{"s":"ok","d":""}}}
2020-07-03 15:58:51.228 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 44392
2020-07-03 15:58:51.228 com.example.paylater D/WebSocket: ws_0 - HandleNewFrameCount: 1
2020-07-03 15:58:51.229 com.example.paylater D/WebSocket: ws_0 - handleIncomingFrame complete frame: {t=d, d={r=21, b={d=, s=ok}}}
2020-07-03 15:58:51.229 com.example.paylater D/Connection: conn_0 - received data message: {r=21, b={d=, s=ok}}
2020-07-03 15:59:30.260 com.example.paylater D/PersistentConnection: pc_0 - Listening on sellers/2 (params: {})
2020-07-03 15:59:30.261 com.example.paylater D/PersistentConnection: pc_0 - Adding listen query: sellers/2 (params: {})
2020-07-03 15:59:30.262 com.example.paylater D/Connection: conn_0 - Sending data: {t=d, d={a=q, r=22, b={p=sellers/2, h=}}}
2020-07-03 15:59:30.263 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 5965
2020-07-03 16:00:15.263 com.example.paylater D/WebSocket: ws_0 - Reset keepAlive. Remaining: 0
2020-07-03 16:00:51.226 com.example.paylater D/WebSocket: ws_0 - WebSocket reached EOF.
2020-07-03 16:00:51.226 com.example.paylater D/WebSocket: ws_0 - closing itself
2020-07-03 16:00:51.226 com.example.paylater D/Connection: conn_0 - Realtime connection lost
2020-07-03 16:00:51.226 com.example.paylater D/Connection: conn_0 - closing realtime connection
2020-07-03 16:00:51.226 com.example.paylater D/PersistentConnection: pc_0 - Got on disconnect due to OTHER
2020-07-03 16:00:51.226 com.example.paylater D/PersistentConnection: pc_0 - Scheduling connection attempt
2020-07-03 16:00:51.226 com.example.paylater D/ConnectionRetryHelper: Scheduling retry in 0ms
2020-07-03 16:00:51.227 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 16:00:51.227 com.example.paylater D/EventRaiser: Raising /.info/connected: VALUE: false
2020-07-03 16:00:51.227 com.example.paylater D/PersistentConnection: pc_0 - Trying to fetch auth token
2020-07-03 16:00:51.229 com.example.paylater D/WebSocket: ws_0 - WebSocket error.
    com.google.firebase.database.tubesock.WebSocketException: IO Exception
        at com.google.firebase.database.tubesock.WebSocketWriter.runWriter(WebSocketWriter.java:159)
        at com.google.firebase.database.tubesock.WebSocketWriter.access$000(WebSocketWriter.java:30)
        at com.google.firebase.database.tubesock.WebSocketWriter$1.run(WebSocketWriter.java:47)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.net.SocketException: Socket is closed
        at com.android.org.conscrypt.AbstractConscryptSocket.checkOpen(AbstractConscryptSocket.java:581)
        at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(ConscryptFileDescriptorSocket.java:609)
        at java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:453)
        at com.google.firebase.database.tubesock.WebSocketWriter.writeMessage(WebSocketWriter.java:138)
        at com.google.firebase.database.tubesock.WebSocketWriter.runWriter(WebSocketWriter.java:152)
        at com.google.firebase.database.tubesock.WebSocketWriter.access$000(WebSocketWriter.java:30) 
        at com.google.firebase.database.tubesock.WebSocketWriter$1.run(WebSocketWriter.java:47) 
        at java.lang.Thread.run(Thread.java:919) 
2020-07-03 16:00:51.229 com.example.paylater D/PersistentConnection: pc_0 - Successfully fetched token, opening connection
2020-07-03 16:00:51.230 com.example.paylater D/Connection: conn_1 - Opening a connection
2020-07-03 16:00:51.233 com.example.paylater D/WebSocket: ws_0 - closed
2020-07-03 16:00:52.825 com.example.paylater D/WebSocket: ws_1 - websocket opened
2020-07-03 16:00:52.825 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive
2020-07-03 16:00:52.826 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"c","d":{"t":"h","d":{"ts":1593772513254,"v":"5","h":"s-usc1c-nss-203.firebaseio.com","s":"QMthzsHOAtBUR6Q05YGUpSKLJIeW1z6J"}}}
2020-07-03 16:00:52.826 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44998
2020-07-03 16:00:52.826 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:52.827 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=c, d={t=h, d={h=s-usc1c-nss-203.firebaseio.com, s=QMthzsHOAtBUR6Q05YGUpSKLJIeW1z6J, v=5, ts=1593772513254}}}
2020-07-03 16:00:52.827 com.example.paylater D/Connection: conn_1 - Got control message: {t=h, d={h=s-usc1c-nss-203.firebaseio.com, s=QMthzsHOAtBUR6Q05YGUpSKLJIeW1z6J, v=5, ts=1593772513254}}
2020-07-03 16:00:52.827 com.example.paylater D/Connection: conn_1 - realtime connection established
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - onReady
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - handling timestamp
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - calling restore state
2020-07-03 16:00:52.827 com.example.paylater D/PersistentConnection: pc_0 - Restoring auth.
2020-07-03 16:00:52.827 com.example.paylater D/Connection: conn_1 - Sending data (contents hidden)
2020-07-03 16:00:52.827 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44998
2020-07-03 16:00:52.828 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 16:00:52.829 com.example.paylater D/EventRaiser: Raising /.info/connected: VALUE: true
2020-07-03 16:00:53.466 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"d","d":{"r":23,"b":{"s":"ok","d":{"auth":{"name":"Yash Singh","email_verified":false,"provider":"password","email":"yashsingh.real@gmail.com","user_id":"QBO65tn5qLVN8zyVB2uMA8UByJ02","token":{"name":"Yash Singh","email_verified":false,"email":"yashsingh.real@gmail.com","exp":1593775621,"user_id":"QBO65tn5qLVN8zyVB2uMA8UByJ02","iat":1593772021,"sub":"QBO65tn5qLVN8zyVB2uMA8UByJ02","aud":"the-creditinator","auth_time":1592475916,"iss":"https://securetoken.google.com/the-creditinator","firebase":{"identities":{"email":["yashsingh.real@gmail.com"]},"sign_in_provider":"password"}},"uid":"QBO65tn5qLVN8zyVB2uMA8UByJ02"},"expires":1593775621}}}}
2020-07-03 16:00:53.467 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44360
2020-07-03 16:00:53.467 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:53.467 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=d, d={r=23, b={d={auth={uid=QBO65tn5qLVN8zyVB2uMA8UByJ02, email_verified=false, provider=password, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, name=Yash Singh, email=yashsingh.real@gmail.com, token={sub=QBO65tn5qLVN8zyVB2uMA8UByJ02, aud=the-creditinator, email_verified=false, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, auth_time=1592475916, name=Yash Singh, iss=https://securetoken.google.com/the-creditinator, exp=1593775621, firebase={sign_in_provider=password, identities={email=[yashsingh.real@gmail.com]}}, iat=1593772021, email=yashsingh.real@gmail.com}}, expires=1593775621}, s=ok}}}
2020-07-03 16:00:53.468 com.example.paylater D/Connection: conn_1 - received data message: {r=23, b={d={auth={uid=QBO65tn5qLVN8zyVB2uMA8UByJ02, email_verified=false, provider=password, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, name=Yash Singh, email=yashsingh.real@gmail.com, token={sub=QBO65tn5qLVN8zyVB2uMA8UByJ02, aud=the-creditinator, email_verified=false, user_id=QBO65tn5qLVN8zyVB2uMA8UByJ02, auth_time=1592475916, name=Yash Singh, iss=https://securetoken.google.com/the-creditinator, exp=1593775621, firebase={sign_in_provider=password, identities={email=[yashsingh.real@gmail.com]}}, iat=1593772021, email=yashsingh.real@gmail.com}}, expires=1593775621}, s=ok}}
2020-07-03 16:00:53.468 com.example.paylater D/PersistentConnection: pc_0 - Restoring outstanding listens
2020-07-03 16:00:53.468 com.example.paylater D/PersistentConnection: pc_0 - Restoring listen sellers/2 (params: {})
2020-07-03 16:00:53.468 com.example.paylater D/Connection: conn_1 - Sending data: {t=d, d={a=q, r=24, b={p=sellers/2, h=}}}
2020-07-03 16:00:53.469 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44997
2020-07-03 16:00:53.471 com.example.paylater D/PersistentConnection: pc_0 - Restoring writes.
2020-07-03 16:00:54.105 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"d","d":{"r":24,"b":{"s":"ok","d":{}}}}
2020-07-03 16:00:54.105 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44364
2020-07-03 16:00:54.106 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:54.106 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=d, d={r=24, b={d={}, s=ok}}}
2020-07-03 16:00:54.106 com.example.paylater D/Connection: conn_1 - received data message: {r=24, b={d={}, s=ok}}
2020-07-03 16:00:54.106 com.example.paylater D/EventRaiser: Raising 1 event(s)
2020-07-03 16:00:54.107 com.example.paylater D/EventRaiser: Raising /sellers/2: VALUE: null
2020-07-03 16:00:54.107 com.example.paylater D/PersistentConnection: pc_0 - unlistening on sellers/2 (params: {})
2020-07-03 16:00:54.107 com.example.paylater D/PersistentConnection: pc_0 - removing query sellers/2 (params: {})
2020-07-03 16:00:54.108 com.example.paylater D/Connection: conn_1 - Sending data: {t=d, d={a=n, r=25, b={p=sellers/2}}}
2020-07-03 16:00:54.108 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44997
2020-07-03 16:00:54.632 com.example.paylater D/WebSocket: ws_1 - ws message: {"t":"d","d":{"r":25,"b":{"s":"ok","d":""}}}
2020-07-03 16:00:54.633 com.example.paylater D/WebSocket: ws_1 - Reset keepAlive. Remaining: 44474
2020-07-03 16:00:54.633 com.example.paylater D/WebSocket: ws_1 - HandleNewFrameCount: 1
2020-07-03 16:00:54.633 com.example.paylater D/WebSocket: ws_1 - handleIncomingFrame complete frame: {t=d, d={r=25, b={d=, s=ok}}}
2020-07-03 16:00:54.633 com.example.paylater D/Connection: conn_1 - received data message: {r=25, b={d=, s=ok}}

在所有这些之后,它大约在一分钟后给出了一个输出,但行为并不一致,我希望日志消息能够提供一些关于这一点的见解。

Firebase客户端尝试连接到服务器时出现指数级后退,因此根据您没有连接的时间长短,可能需要一些时间才能重新连接?你等它重新连接了多久?它可能也有助于检查/包括输出。@FrankVanPuffelen我想我等了大约半分钟才重新连接。那么,当我打开移动数据后等待大约10分钟时,这是否足以导致在它重新连接之前的大量时间?此外,我将继续启用调试日志记录,并包括它的输出,因为它似乎可能会带来一些见解。是的,在30秒断开连接时,它肯定会比您所说的更快地重新连接。希望调试日志能够提供一些见解,因为它们准确地显示了客户端尝试(重新)连接的时间以及它得到的响应(如果有的话)。Firebase客户端尝试连接到服务器时出现指数级回退,因此根据您没有连接的时间长短,可能需要一些时间才能重新连接?你等它重新连接了多久?它可能也有助于检查/包括输出。@FrankVanPuffelen我想我等了大约半分钟才重新连接。那么,当我打开移动数据后等待大约10分钟时,这是否足以导致在它重新连接之前的大量时间?此外,我将继续启用调试日志记录,并包括它的输出,因为它似乎可能会带来一些见解。是的,在30秒断开连接时,它肯定会比您所说的更快地重新连接。希望调试日志能够提供一些见解,因为它们准确地显示了客户端何时尝试(重新)连接以及得到了什么响应(如果有的话)。