1 Reply Latest reply on Jun 8, 2018 8:35 PM by fwalsh

    refresh

    svizer

      Hi All,

       

      I am looking for a simple way to ensure that a Pi Vision display gets refreshed on a periodic basis, say every 15mins. I am not worried about an update of the data as I know the platform does a DiffForData regularly and I can see data flowing, that's not the issue.

       

      I am trying to resolve what I believe are network disruptions (sessions perhaps being dropped by the NLB) to the displays as there are daily issues and the best fix is to just hit F5 on the page.

       

      Any help or pointers would be appreciated, I did apply a hack to the index.cshtml file which worked but that is not ideal as there are some Displays that don't react well to a refresh due to them not being developed for being stretched across 8 TV's, (another issue!). So I need a solution that can be selectively applied to a Display.

       

      Thanks,

      Shaun

        • Re: refresh
          fwalsh

          Hi Shaun,

          If there's no other way to diagnose and resolve the network problem, there are some workarounds we could implement.

           

          Understanding that this is an uncommon issue (and this workaround is not by any means a 'best practice'), one possible solution is to create a custom symbol that will automatically refresh the page after a certain time period.

          I did this by creating a custom symbol that sets a page refresh on a timeout as soon as the symbol is loaded by including a setTimeout in the .init function:

           

              symbolVis.prototype.init = function (scope, element) {
                  setTimeout( () => {document.location.reload()}, 900000);
              };
          

          Some notable flaws with this strategy:

          • The symbol will always set a refresh timeout when loaded, even in the Editor. This could cause you to lose progress if you are editing a display for a long time
          • Since the symbol will set a timeout that fires regardless of context, it could fire when unintended; for example, if an end user views the 'refresh' display, then switches to a secondary display, the timeout will fire and reload the page after a while.

          These could be addressed by causing the reload function to check if the current display is the display it was fired on. I have not researched yet exactly how to do this, but it is an option. Some pseudocode:

           

              symbolVis.prototype.init = function (scope, element) {
                  (function(){
                     let thisDisplay = {this display};
                     setTimeout( () => {
                          if (currentDisplay == thisDisplay){
                              document.location.reload();
                          }, 900000);
                  }())
              };
          

          A more robust solution would involve creating a global script that occasionally checks if connection has been lost, and then issues a refresh command. This way, any display that typically experiences these issues would be rectified as the issue happens.