server/adapters/AisProxyNmea-adapter.js
function SetGarbage (proxy, timeout) {
    // let's call back ourself after timeout*1000/4
    proxy.Debug (4, "SetGarbage timeout=%d", timeout);
    setTimeout (function(){SetGarbage (proxy, timeout);}, timeout*500);
    
    // let compute timeout timeout limit
    var lastshow = new Date().getTime() - (timeout *1000);
    
    for (var mmsi in proxy.vessels) {
        var vessel = proxy.vessels[mmsi];
        if (vessel.lastshow < lastshow) {
            proxy.Debug (5, "Removed Vessel mmsi=%s", mmsi);
            delete proxy.vessels [mmsi];
        }
    }
      
}
function SetGarbage (proxy, timeout) {
    // let's call back ourself after timeout*1000/4
    proxy.Debug (4, "SetGarbage timeout=%d", timeout);
    setTimeout (function(){SetGarbage (proxy, timeout);}, timeout*500);
    
    // let compute timeout timeout limit
    var lastshow = new Date().getTime() - (timeout *1000);
    
    for (var mmsi in proxy.vessels) {
        var vessel = proxy.vessels[mmsi];
        if (vessel.lastshow < lastshow) {
            proxy.Debug (5, "Removed Vessel mmsi=%s", mmsi);
            delete proxy.vessels [mmsi];
        }
    }
      
}
function SetGarbage ( proxy , timeout ) { // let's call back ourself after timeout*1000/4 proxy . Debug ( 4 , "SetGarbage timeout=%d" , timeout ) ; setTimeout ( function ( ) { SetGarbage ( proxy , timeout ) ; } , timeout * 500 ) ; // let compute timeout timeout limit var lastshow = new Date ( ) . getTime ( ) - ( timeout * 1000 ) ; for ( var mmsi in proxy . vessels ) { var vessel = proxy . vessels [ mmsi ] ; if ( vessel . lastshow < lastshow ) { proxy . Debug ( 5 , "Removed Vessel mmsi=%s" , mmsi ) ; delete proxy . vessels [ mmsi ] ; } } }
this function scan active device table and remove dead one based on inactivity timeout
this function scan active device table and remove dead one based on inactivity timeout