Online Syncronisation not working for PWA apps
Question

Hi Team

I have created a ToDo mobile application in Outsystems 11 and distributed it as PWA. The PWA which I am testing is installed in my laptop. Now I am testing its SyncOnOnline functionality.

1. I logged into my application in online mode.

2. Then I disconnected my internet connection of my laptop and created a new ToDo.

3. Then I connected my internet back but the Syncronisation is not happing. Although I have set SyncOnOnline =true in OfflineDataSyncConfiguration client action.

Please suggest solution for this.

mvp_badge
MVP

Hi Vivek,

There is no (OutSystems) team here, only community members.

Offline sync is supported for PWA. Did you check if the sync logic works when you distribute the mobile app to iOS or Android device. It might as well be that you have a logic error not related to the fact that you run the app as a PWA.

Furthermore, to distribute your app as a PWA, you need:

  • Service Studio 11.6 or later
  • Platform Server 11.9 or later
  • LifeTime Oct.2019 CP1 or later
  • A valid SSL certificate to allow HTTPS communication

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi Vivek,

There is no (OutSystems) team here, only community members.

Offline sync is supported for PWA. Did you check if the sync logic works when you distribute the mobile app to iOS or Android device. It might as well be that you have a logic error not related to the fact that you run the app as a PWA.

Furthermore, to distribute your app as a PWA, you need:

  • Service Studio 11.6 or later
  • Platform Server 11.9 or later
  • LifeTime Oct.2019 CP1 or later
  • A valid SSL certificate to allow HTTPS communication

Regards,

Daniel

 Hi Daniel 

Thanks for your reply... 

I will check the same. 


 

Hi Vivek, 

I am facing the same issue as you. Did you find the solution for this?

Hi @Luc Le

For this I used this component: https://www.outsystems.com/forge/component-overview/3303/offlinedetection

You can test it here: https://galmeida.outsystemscloud.com/ToDo/ with the pwa to do app.

You can also check the implementation in the oml attached.

Regards

Gonçalo Almeida


ToDo.oml

Hi @Goncalo Almeida , Thank you for your answer, I solved my issue by following your oml. Once again thank you very much.

yw @Luc Le

Glad I could help 

Regards

Gonçalo Almeida

Hi @Goncalo Almeida , I am facing another issue when using Offline Detection, which is so many requests be sent which leads to over local storage. Please see my attachment. Thanks

20210429141939.png

Hello @Luc Le 

Sorry for the late response but I just só your message a few minutes ago.

Glad you can solve it.

Please share the solution in order for others can know how to fix it when they are facing the same issue.

Regards,

Gonçalo Almeida


Hello @Goncalo Almeida,

That was my mistake, I called recursively between 2 aggregates so that the issuse happend. But now I don't use OfflineDetection. In OnInitialize event in layout, I add 2 event listener to detect when a network change .

window.addEventListener('online', function(){

    $actions.TriggerOnline();

    console.log('Became online');

});

window.addEventListener('offline', function(){

    $actions.TriggerOffline();

    console.log('Became offline');

});

@Luc Le 

Simple and clean.

Regards.

Gonçalo Almeida

Hi @Goncalo Almeida 

I create this component https://www.outsystems.com/forge/component-overview/10805/networkdetection-oml you can try and give me feedback.

Thank

Luc Le

Hi @Luc Le 

Great ideia.

Works perfectly.

Regards

Gonçalo Almeida

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.