This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

LM5 without webscoket
#6
@Thomas, WebSocket is much better for performance and CPU load. If Opera works correctly on your devices, there's no point in using long polling.

@savas, try this solution (for now it will only work with admin account). Your device must be running latest firmware as well. If it works for you then I'll provide a full solution for non-admin users.

Code:
if (!window.WebSocket) {
  function doObjectUpdate(res) {
    if (typeof res == 'object' && res.updatetime) {
      if (res.updatetime != Globals.updateTime) {
        Globals.updateTime = res.updatetime;

        $.each(res.data || [], function(_, obj) {
          objectStore.registerOne(obj.address, obj.datadec);
        });
      }
    }
    
    startObjectUpdate();
  }
  
  function startObjectUpdate() {
    $.ajax({
      url: '/scada-main/objects/update',
      type: 'GET',
      dataType: 'json',
      data: { upd: Globals.updateTime },
      error: doObjectUpdate,
      success: doObjectUpdate,
      timeout: 60 * 1000
    });
  }

  function setObjectValueSend(data) {
    $.ajax({
      url: '/scada-main/objects/setvalue',
      type: 'POST',
      data: Scada.encodeData(data)
    });
  }

  localbus.init = function() {};
}
Reply


Messages In This Thread
LM5 without webscoket - by savaskorkmaz - 25.04.2018, 09:08
RE: LM5 without webscoket - by savaskorkmaz - 03.05.2018, 20:54
RE: LM5 without webscoket - by admin - 04.05.2018, 05:25
RE: LM5 without webscoket - by buuuudzik - 04.05.2018, 06:58
RE: LM5 without webscoket - by Thomas - 07.05.2018, 10:10
RE: LM5 without webscoket - by admin - 07.05.2018, 10:57

Forum Jump: