• Nick

    (@nickchomey)


    Hi there, this plugin is fantastic!

    My main question/feedback right now is if there might be a way to cache content that is loaded via AJAX?

    I use the BuddyBoss platform and the majority of the site content loads via AJAX – news feed activity posts, member directory, group directory, tabs in profiles and groups etc… However, none of it seems to get cached.

    Also, I’m a developer as well, so I’d also be happy to help test and develop something like this if you can give me a bit of guidance!

    Thanks!

    p.s. I tried to register for your site/forum, but I never received an activation email. Perhaps your email service is broken?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Interesting story!

    I can’t imagine what the cache of ajax communication specifically refers to, but are you saying that you want to cache ajax in offline content in PWA?

    I’ve never touched BuddyBoss, but when it comes to ajax caching, I think fixing “HTTP headers” is common.
    Probably, now cache is rejected from cache control, and “Pragma” also has a value that rejects cache. If you fix it correctly, the ajax output can be cached in the browser.

    I don’t know if ajax can be used in the cache for offline content, but if the above solution cannot be used, for example, I think that a special query will be added only for PWA or the process will be branched in some way.

    For example, in the case of PWA access, Separately obtaining a page including ajax communication on PHP and returning that content.

    p.s.
    I also can’t enter the forum. It’s broken….?

    Thread Starter Nick

    (@nickchomey)

    It appears that https://www.muraliwebworld.com/ uses buddypress rather than buddyboss, but it also seems to load the majority of things via Ajax.

    Just go there and load the activity or groups page and you’ll see that the page loads first and then the content loads afterwards. Or go to a user profile and change tabs. It is difficult to see, because they use that annoying blue loading screen, but you can usually see a brief glimpse of the page being loaded without any content and then the content filling in afterwards.

    Moreover, if you install the PWA for that site browse some pages and then turn off your internet connection, you’ll see that none of the pages load at all. You just get browser errors. At least on my site it loads the page but doesn’t have any content.

    So, in order for the PWA offline cache mechanism to be useful for Buddypress/Buddyboss, it would be crucial to cache content that loads via Ajax. I don’t know anything about how to do so, but your suggestions sound like reasonable things to try out! I hope the dev will be able to give it some consideration soon!

    Thread Starter Nick

    (@nickchomey)

    Here’s an excellent article on this topic of dynamic offline content. There’s MANY approaches to it, but the ones that they end up suggesting do seem ideal. It even has information about how users can create posts while offline, and have then sync either automatically or upon clicking a sync button when back online.

    https://www.monterail.com/blog/pwa-offline-dynamic-data

    And resources from Google on PWAs
    https://web.dev/offline-cookbook/
    https://web.dev/progressive-web-apps/
    https://web.dev/pwa-with-offline-streaming/
    https://kinoweb.dev/

    Plugin Author Murali

    (@murali-indiacitys)

    I will look into your suggestions and also i have resolved email problems in plugin help forum (my site). This plugin has PWA with offline cache and if you include those urls service worker will create custom cache for included urls in pwa settings area in browser (under application tab) and when there is no internet, these offline pages will be displayed and for the urls not cached then it will display default offline page.

    Thread Starter Nick

    (@nickchomey)

    Thanks for the reply!

    But I think you have misunderstood my feedback. I understand that you can select urls to be cached, but the problem is that it only caches the static content and not the dynamic that is loaded by Ajax.

    For example, site.com/members is the members directory. If you cache that page, it stores the static content – the headers etc… – but not the actual page content, which are the cards for each member on the site. Same thing for Groups directory, news feed, any profile or group tab etc…

    And the pwa for your own site doesn’t work at all offline – I presume it is because you use the blue loading screen.

    The links I shared describe various techniques for offline caching of dynamic data. I suspect you are not making use of any of this right now, and thus are only caching the static data.

    I’d be happy to discuss any of this further and help spec, test and even develop some mechanisms for proper offline dynamic caching!

    Plugin Author Murali

    (@murali-indiacitys)

    For dynamic caching it is better to create custom api for buddypress and cache the api latest results whenever it is fetched, so that latest results will be cached and frontend website or app will fetch it from cache instead of data ase for offline/ online use , it is similar to developing app as frontend using wordpress as backend. I will also do research and try to include api results in service worker cache for offline. I have already created custom api for buddypress long back to create activity, signup users, login user and other functions for my own use to develop kotlin app using wordpress as backend. I will try use those api to integrate with service worker cache.

    Thread Starter Nick

    (@nickchomey)

    Great! I’m glad to hear that you have a good idea about how to do all of this.

    Please let me know if I can be helpful in any way – I don’t have any experience with PWAs, apps, caching etc…, but I am quite competent with BuddyPress/BuddyBoss development. If you created a project on Github with various issues that describe what is needed, I’d be happy to try to build some of the mechanisms.

    I think this could be a very useful and important tool in order to “modernize” BuddyPress with an app-like experience. BuddyBoss has its own native apps, but it is very expensive.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Offline Caching of Ajax Content’ is closed to new replies.