function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric FortenberryEric Fortenberry 

Site with ActionFunction Not Updating

Goal:  Build a real-time dashboard that auto updates when new cases are created and when cases are updated.  This dashboard will be displayed on an LCD montior that is hung on a wall in our office.  The page should stay alive indefiniately and not require signing in or refreshing.

I created a controller and visualforce page using ActionFunction (following the instructions in this article (" target="_blank)).

Everything works great for a little while, then the visualforce page stops updating.  I'm assuming my authentication is timing out, but I'm not completely sure.

To try to get around needing to be authenticated, I created a site and made the page and controller available to the site.  I also made the static resouce cache control public.  However, the page does not update at all.  And even when I try to refresh the site, it doesnt update.

Any ideas on how I can accomplish my goal or why the public site is not working or even why my visualforce page does not continue to refresh after 15 minutes or so?

Eric FortenberryEric Fortenberry
Regarding the site not updating at all, I believe I've tracked down the issue to be related to the following javascript function:

     url: window.location.protocol+'//'+window.location.hostname+'/cometd/29.0/',
     requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
When I view the working visualforce page and use the javascript inspector, I can see the page referencing this URL:

However, when I view the site and use the javascript inspector, it is referencing a URL that includes my org domain:  http://[domain]

Is there a better way to generate the cometd URL without having to hardcode it?

Eric FortenberryEric Fortenberry
Ok, so I believe using the secure site url gets around this issue.  Now I'm thinking the issue is that there is no way to give the Guest User permission to Push Topics.