Skip to content

Smarter LiveSync #977

Closed
Closed

Description

@teobugslayer

Smarter LiveSync without restarts

  • CLI: Respect deleted files
  • CLI: When sending xml and css files to the device, do not restart the app
  • CLI: When syncing JS, images, fonts, or other resources - restart the entire app
  • CLI: Implement a dedicated tcp socket as communication channel between it and the runtimes
  • CLI: Notify runtimes after the files are on the device that the change had happened
  • CLI: Research if we can fast sync for other file types (mostly images)
  • CLI: Lower batch time in the cli to 250ms
  • CLI: Implement together batch livesync/restart with fast livesync

  • Android runtime: spike tcp socket as communication channel between it and the CLI.
  • Android: notify modules when files are changed and the current page must be reloaded - see bellow

  • iOS: notify modules when files are changed and the current page must be reloaded - see bellow

  • Modules: implement a global function (tentative name: __nativeScriptLiveSyncCallback). The run times will call it whenever the current page needs to be reloaded

Activity

  1. added this to the 1.5 milestone on Oct 22, 2015
  2. NathanaelA commented on Oct 22, 2015

    @NathanaelA
  3. x4080 commented on Oct 23, 2015

    @x4080

    I think Nathanael solution is pretty good in Android.the ios simulator version is already pretty fast, maybe Android is urgently need the update or just use Nathanael solution

  4. teobugslayer commented on Oct 23, 2015

    @teobugslayer
    Author

    Thank you for sharing your research about fonts! Did you verify this behavior on both iOS and Android?

    Please bear in mind that this issue focuses only on the changes which we are introducing in NativeScript 1.5. We will continue improving LiveSync in the following releases. We need more time to discover and fix all the edge cases on both platforms.

    There's a separate issue about linting. We think it is a very good idea and needs to be done at first opportunity.

  5. NathanaelA commented on Oct 23, 2015

    @NathanaelA
  6. x4080 commented on Oct 23, 2015

    @x4080

    And how about a feature to load script from http server? I think about for development and easy update for production purposes. It will be awesome

  7. kaydevdev commented on Oct 26, 2015

    @kaydevdev

    Yes livesync from an HTTP server would be great for Native Script @x4080 @teobugslayer

    This feature is a requirement of many projects I have coming up and is the only reason React Native is still an option for me. They already have the feature but I prefer Native Script for everything else.

    The release of this feature I think would greatly improve Native Script's popularity because it enables devs to support customer deployments in a much faster and efficient way.

    I am willing to contribute in any way I can to the expedition of the implementation of this feature.

  8. amjd commented on Nov 12, 2015

    @amjd

    It would be awesome if support for console.log() is added in LiveSync mode too. Or any other way to debug apps while in LiveSync mode.

  9. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Nov 16, 2015
  10. vchimev commented on Nov 23, 2015

    @vchimev
    Contributor

    Hi @amjd,

    consoloe.log() will be supported with LiveSync in {N} version 1.5.0 (NativeScript/nativescript-cli#1130) for Android device/emulator and iOS device - iOS simulator will be added in the next versions.

  11. vchimev commented on Nov 23, 2015

    @vchimev
    Contributor

    Please refer to https://github.com/NativeScript/nativescript-cli/issues for any LiveSync related issues.

  12. added and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Nov 23, 2015
  13. toddanglin commented on Nov 24, 2015

    @toddanglin

    Are there any special requirements to make the new LiveSync work in {N} 1.5.0? I'm using the iOS Simulator and running tns livesync ios still causes the app to reload.

    FWIW, the terminal shows this error when running livesync with the iOS simulator:
    Unable to start service com.apple.mobile.house_arrest. Result code is: 3892314239

    Simulator still loads fine, so not sure the implication of this error. Looked at trace logs, but few obvious errors there. Only error that occurs in logs before one above is this:

    stderr: 
    Transferring project files...
    Transferring project files...
    Multiple exceptions were thrown:
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:535:15)
    ...
    
  14. GitCharm commented on Nov 25, 2015

    @GitCharm

    Issue with Android- calling "tns livesync android" with my connected Android device and am getting the following error:

    Project successfully prepared
    Transferring project files...
    spawn ENAMTOOLONG

    Thanks in advance for assistance on this

  15. Fatme commented on Nov 25, 2015

    @Fatme
    Contributor

    Hi @toddanglin,

    It seems that you have connected device and running simulator. In order to livesync to iOS simulator execute tns livesync ios --emulator command. If you change .xml or .css file the application will not restart but if you change .js file the application will restart.

  16. Fatme commented on Nov 25, 2015

    @Fatme
    Contributor

    Hi @GitCharm,

    Can you execute tns livesync android --log trace and send us the produced log output.

  17. toddanglin commented on Nov 25, 2015

    @toddanglin

    Thanks, @Fatme. I actually don't have any other iOS devices physically connected...but tns device does show additional iOS devices. Not sure if that's bad caching of previously connected devices OR if somehow the devices are being detected over WiFi.

    Either way, the tns livesync ios --emulator command eliminates the error, BUT...

    The iOS simulator is still restarting every time I issue the livesync command. Here is the last part of the log trace when I run tns livesync ios --emulator:

    Project successfully prepared
    AfterHookName for command prepare is after-prepare
    Exec ps cax | grep launchd_sim 
     stdout: 79938   ??  S      0:00.88 launchd_sim
    
     stderr: 
    Exec killall icn 
     stdout:  
     stderr: 
    Exec xcrun simctl launch 4232A8A4-DEE0-43BE-84EE-2A3B8F6161C3 com.htmlui.icn 
     stdout: com.htmlui.icn: 81945
    
     stderr:
    

    Seems livesync is doing a killall every time I run it (regardless of what files do/don't change).

  18. ignaciofuentes commented on Nov 25, 2015

    @ignaciofuentes

    I am having the same experience as @toddanglin

    I can actually see the visual change right before the app restarts.
    I suspect it's related to the typescript compilation step.

  19. vchimev commented on Nov 25, 2015

    @vchimev
    Contributor

    @toddanglin,
    could you please make sure that you upgraded the tns-core-modules package in your app? If you open the package.json file of your app, under dependencies the record for tns-core-modules should point to 1.5.0.

  20. ignaciofuentes commented on Nov 25, 2015

    @ignaciofuentes

    I just created a brand new hello world app and the smart livesync works just fine...
    after running "tns install typescript" every XML/CSS change triggers a restart of the app. :(

  21. toddanglin commented on Nov 27, 2015

    @toddanglin

    @vchimev Yes, I can confirm that tns-core-modules has been upgraded to 1.5.0. In fact, I deleted the entire tns-core-modules directory and then let npm re-install the latest version to be sure all modules were 100% fresh/upgraded.

    @ignaciofuentes That's interesting. To test, I created a brand new project and smart livesync still restarts the app with each update (no TypeScript). I'm testing against iOS simulator on OS X.

  22. chrisbarry commented on May 31, 2016

    @chrisbarry

    At the moment, I'm seeing a pretty poor livesync experience with ios. The app fully restarts, and requires a 5-10 second reload time, losing state in the process.

    I'm not 100% sure, but due to the existence of this project https://github.com/NathanaelA/nativescript-liveedit and that React Native seems to have a lot swifter reloading, is this something that NativeScript is going to be pushing to achieve (ie hot reloading of as much of the app as possible, without a full rebuild/restart, particularly for JS / logic files)?

  23. toddanglin commented on May 31, 2016

    @toddanglin

    @chrisbarry Sorry to hear you're having that much trouble. Not normally the livesync experience.

    That said, the 2.1 release is aiming to make hot reloading in NativeScript even more robust/faster. Definitely something the core team is continuing to invest a lot of time in improving. You can see it on the high-level roadmap here: https://www.nativescript.org/roadmap

    The goal is to support the hot reloading experience you describe: fast, reload all assets, retain state

  24. chrisbarry commented on Jun 1, 2016

    @chrisbarry

    @toddanglin many thanks for the response, NativeScript does seem to be one of the cleanest cross platform tools available today.

    2.1 sounds exciting, looking forward to trying that out once it's ready!

  25. lock commented on Aug 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  26. locked and limited conversation to collaborators on Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions