edusperoni/nativescript-mqtt

Plugin not working with Nativescript 7 on iOS

kryptus36 opened this issue · 4 comments

Which platform(s) does your issue occur on?

iOS, emulator & physical device.
Works on Android.

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it)

7.0.8

  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)

    "@nativescript/core": "~7.0.10",
    "@nativescript/ios": "7.0.1"

The problem actually occurs in the underlying paho-mqtt.js file. Line 733. It looks like maybe NS doesn't export clearTimeout as a global any more but that's purely a guess. I tried a couple of import/require statements in the file but couldn't get it to work.

It's possible this is a bug in NS itself in the switch to V8. I can file a bug there if that is indeed the case

TypeError: clearTimeout is not a function
at Pinger.reset (file:///app/vendor.js:98371:5)
at ClientImpl.LibraryFactory.ClientImpl._socket_send (file:///app/vendor.js:99115:20)
at ClientImpl.LibraryFactory.ClientImpl._on_socket_open (file:///app/vendor.js:98854:9)
at NativeWebSockets.onopen (file:///app/vendor.js:97821:14)
at NativeWebSockets.push.NativeWebSockets._notifyBrowser (file:///app/vendor.js:64339:29)
at NSObject_2.webSocketDidOpen

Hey @kryptus36. It does seem something is not being polyfilled in time. I'll take a look but this is probably something that has to be handled in the core implementation.

I'll try to find a workaround somewhere to make sure these globals are properly polyfilled

@edusperoni thanks, I appreciate it! Let me know if I should file a bug over there.

@kryptus36 please take a look at the newest published version 3.0.0. It's a complete refactor and should have this issue fixed.

Thanks for the update!

I'm no longer seeing this issue but I am having another issue. I'll file a separate bug...