Closed unoravi closed 3 years ago
Hi! Thanks for reporting the issue. This may be caused by some unrecognized exception thats throwing off builtin diagnostics. However, it may be possible to fix this by adding your own diagnostic function:
import `package:pubnub/core.dart`;
import 'package:pubnub/src/networking/meta/diagnostics.dart';
pubnub.supervisor.registerDiagnostic((exception) {
if (exception is Exception) { // check what kind of exception that is
return HostIsDownDiagnostic('ps.pndsn.com', 80); // example diagnostic
// you can also use UnknownHttpExceptionDiagnostic()
}
});
@are
I have used this code and start application. On internet disconnection, I got exception : "PubNubException: request failed". Flutter Doctor and code details are still same as display earlier. Please let me know if you need anymore details.
Thanks
Can you print out and let me know what kind of exception is passed into the registerDiagnostic
callback?
For example:
print(exception);
print(exception.runtimeType);
Hello,
Here is the result of below code.
pubnub.supervisor.registerDiagnostic((exception) {
print("Exception : $exception");
print("Exception Runtime Type : ${exception.runtimeType}");
});
Result :
Exception : PubNubException: request failed
[ ] #0 new PubNubException (package:pubnub/src/core/exceptions.dart:9:29)
[ ] #1 new PubNubRequestOtherException (package:pubnub/src/core/net/exceptions.dart:21:56)
[ +13 ms] #2 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:17)
[ ] <asynchronous suspension>
[ ] #3 Future.any.onValue (dart:async/future.dart)
[ ] <asynchronous suspension>
[ ] flutter: Exception Runtime Type : PubNubRequestOtherException
[ +1 ms] [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PubNubException: request failed
[ +3 ms] #0 new PubNubException (package:pubnub/src/core/exceptions.dart:9:29)
[ +1 ms] #1 new PubNubRequestOtherException (package:pubnub/src/core/net/exceptions.dart:21:56)
[ +1 ms] #2 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:17)
[ ] <asynchronous suspension>
[ ] #3 Future.any.onValue (dart:async/future.dart)
[ ] <asynchronous suspension>
[ ] #0 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:11)
[ +1 ms] <asynchronous suspension>
[ ] #1 Future.any.onValue (dart:async/future.dart)
[ ] <asynchronous suspension>
Please let me know if any.
Thanks
Sorry for not being able to resolve this issue quickly, but you have to keep in mind that Flutter on Windows is in alpha and not everything will work correctly. This issue may be fixed by our next release next week, but it doesn't guarantee that.
@are Thank you so much for the info. I will keep checking upcoming releases and if in case you came to know the issue resolution release number then please share if you can..
We have released new version 3.1.0
. Can you let us know if the issue persists?
@are I have check this version (3.1.0) for Desktop Platforms. It resolved pubnub re-connection issue for Windows & Linux both. On windows, I can listen internet connect/disconnect on Windows but not able to listen the same on Linux. Here is the code used on both platforms.
_pubnub.signals.networkIsConnected.listen((isConnected) async {
print("Network Update. Internet Connection Status : $isConnected");
});
At the time of internet ON-OFF, windows execute print statement but Linux doesn't execute print statement and doesn't react anything. Please suggest if any solution for this.
Thanks for on time support.
@are Android, Windows and Linux devices are facing connection list once it goes idle for 4-5 hours. Pubnub configuration statements are as shown below. I have tried Exponential Network Policy too but issue remains the same.
var keySet = Keyset(subscribeKey: subscribeKey, publishKey: publishKey, uuid: UUID(DeviceUUID));
keySet.heartbeatInterval = 60; // in secs
_pubnub = PubNub(networking: NetworkingModule(retryPolicy: RetryPolicy.linear()), defaultKeyset: keySet);
Please suggest me the proper solution in which Pubnub stay connected for idle time at-least 24 hours.
Thanks
@unoravi What is the problem exactly? Do you get any exceptions? Does it just stop receiving messages without any information? What does the logging say?
@are Yes, it just stop receiving messages without any information/signal/notification.. Application is not getting any kind of exception or logging for remote action. No response or reaction from Application side.
Can you enable logging on LogLevel.silly and send it here or if you are conscious of privacy send it to PubNub support and mention that its for me? Without any additional info it will be very hard to resolve this issue.
@are : Shared details on Pubnub Support and also mendtioned that it's for you (@are)
Thanks
@are : I faces connection lost issue and issue logs are attached on Pubnub Support Ticket...
I'm trying to analyze the logs and come up with something meaningful, but it's hard to say what is happening there.
One thing that you can try to do is to include a Timer that runs every n
minutes (like 15, 30, 60) that calls the pubnub.reconnect()
method. This will refresh the connections in case they go stale. It won't result in data loss so you can safely call it.
Also thanks to your latest logs we have found a bug! I'm in process of fixing it and this should allow your long running app to receive the messages properly.
@are Please let me know once done so that I can proceed further.
Thanks
Thanks for the long wait! Fix for this is released in 3.2.0
. Let us know if you still run into this problem!
Flutter-Channel : dev
Note : Same code works properly for Android but not working on Windows Desktop.
Flutter Doctor :
` [√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.18363.1016], locale en-CA) • Flutter version 1.26.0-1.0.pre at C:\Program Files\flutter • Framework revision 63062a6443 (8 days ago), 2020-12-13 23:19:13 +0800 • Engine revision 4797b06652 • Dart version 2.12.0 (build 2.12.0-141.0.dev)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at C:\Users\street\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.2 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) X Android license status unknown. Run
flutter doctor --android-licenses
to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.7.30621.155 • Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.52.1) • VS Code at C:\Users\street\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.17.0
[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18363.1016] • Chrome (web) • chrome • web-javascript • Google Chrome 87.0.4280.88 • Edge (web) • edge • web-javascript • Microsoft Edge 85.0.564.70
! Doctor found issues in 1 category. `
Error is shown below.
[+98719 ms] [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PubNubException: request failed [ +1 ms] #0 new PubNubException (package:pubnub/src/core/exceptions.dart:9:29) [ ] #1 new PubNubRequestOtherException (package:pubnub/src/core/net/exceptions.dart:21:56) [ ] #2 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:17) [ +18 ms]
[ ] #3 Future.any.onValue (dart:async/future.dart)
[ ]
[ ] #0 RequestHandler.response (package:pubnub/src/net/request_handler.dart:82:11)
[ ]
[ ] #1 Future.any.onValue (dart:async/future.dart)
[ +1 ms]