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
My socket disconnected when my page rerendered.Here is my frontend code:
// create a socket connectionPinusSocketioClient(ip, port, onConnect: (client) async {
final accessToken =awaitHttpHandler.getAccessToken();
// emit a message to get result
client.request([
apiMap.CONNECTOR_entry,
{
'roomId': roomId,
'userId': userId,
'userName': userName,
'userAvatar': userAvatar,
'lat':0.1,
'lon':0.1,
'accessToken': accessToken
},
(data) {
// getAllUserInfo_getAllUsers().then((usrs) {
// a rerender events, when comment canceled,the rerender function disconnected my connection// updateUsers(usrs);
completer.complete(true);
});
}
]);
}, onDisconnect: (client) {
// when rerendered, here comes.print('disconnected ${DateTime.now()}');
connected =false;
_currClient =null;
client.disconnect();
if (!completer.isCompleted) {
completer.complete(false);
}
}, onError: (err, client) {
print('error');
connected =false;
client.disconnect();
if (completer.isCompleted) {
completer.complete(false);
}
});
When the rerender function has been called, my node socketio process consoled 'ping timeout' immediatly.I know about socketio's ping/pong theory, but it happens every time when I rerendered and it is not caused by io's heartbeat.
Then my frontend application closed because of 'transport close'.
I am very certain that my socket does not disposed by myself. Socket is singleton in my app and cannot be garbage collection.
I'm very curious about the bug in my app and I can't find a way to solve it 😭😭😭. I'll be truly and deeply grateful for an answer!
The text was updated successfully, but these errors were encountered:
I tried emulator in Android Studio, and it doesn't disconnected when app rerendered. But when I push my route with go_router,socket disconnected again😭😭😭.
My socket disconnected when my page rerendered.Here is my frontend code:
When the rerender function has been called, my node socketio process consoled 'ping timeout' immediatly.I know about socketio's ping/pong theory, but it happens every time when I rerendered and it is not caused by io's heartbeat.
Then my frontend application closed because of 'transport close'.
I am very certain that my socket does not disposed by myself. Socket is singleton in my app and cannot be garbage collection.
I'm very curious about the bug in my app and I can't find a way to solve it 😭😭😭. I'll be truly and deeply grateful for an answer!
The text was updated successfully, but these errors were encountered: