pubnub / dart

PubNub Dart SDK
Other
28 stars 15 forks source link

Not able to subscribe when running the App from Chrome. #49

Closed redjanym closed 3 years ago

redjanym commented 3 years ago

We are having issues running our app in web version.

    PubNub pubnubInstance;

    pubnubInstance = PubNub(
      defaultKeyset: Keyset(
        subscribeKey: 'sub-k',
        uuid: UUID("some-uuid"),
      ),
    );

    pubnubSubscription = pubnubInstance.subscribe(
        channels: {"some-channel"},
        channelGroups: {'all_channels'}
    );

    pubnubSubscription.messages.listen((envelope) {
      useMessage(envelope.payload);
    });

When we subscribe to pubnub we get this error:

Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
Debug service listening on ws://127.0.0.1:64067/_uT-RC-LZX4=/ws

Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
Debug service listening on ws://127.0.0.1:64067/_uT-RC-LZX4=/ws
Error: UnimplementedError
    at Object.throw_ [as throw] (http://localhost:64017/dart_sdk.js:5333:11)
    at stub.RequestHandler.new.get isCancelled [as isCancelled] (http://localhost:64017/packages/pubnub/src/networking/request_handler/stub.dart.lib.js:36:24)
    at subscribe_loop.SubscribeLoop.new._loop (http://localhost:64017/packages/pubnub/src/subscribe/subscribe_loop/subscribe_loop.dart.lib.js:146:55)
    at _loop.next (<anonymous>)
    at _AsyncStarImpl.new.runBody (http://localhost:64017/dart_sdk.js:31858:40)
    at _RootZone.runUnary (http://localhost:64017/dart_sdk.js:38888:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:64017/dart_sdk.js:33874:29)
    at handleValueCallback (http://localhost:64017/dart_sdk.js:34434:49)
    at Function._propagateToListeners (http://localhost:64017/dart_sdk.js:34472:17)
    at _Future.new.[_completeWithValue] (http://localhost:64017/dart_sdk.js:34314:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:64017/dart_sdk.js:34337:35)
    at Object._microtaskLoop (http://localhost:64017/dart_sdk.js:39175:13)
    at _startMicrotaskLoop (http://localhost:64017/dart_sdk.js:39181:13)
    at http://localhost:64017/dart_sdk.js:34688:9

Flutter version: 2.0.6 Pubspec file:

name: portable_app
description: A new Flutter project.
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  http: ^0.13.3
  pubnub: ^3.2.0
  scoped_model: ^1.1.0
  shared_preferences: ^2.0.5

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

Flutter Doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 2.0.6, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en-AL)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Xcode - develop for iOS and macOS
    ! CocoaPods 1.9.1 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

Thanks in advance.

are commented 3 years ago

Hi! Thanks for reporting the issue! This is fixed in our latest version 4.0.0-beta.0. Let me know if the issue persists after upgrading!

redjanym commented 3 years ago

Now it works. Thanks for the fast reply :)