@@ -2960,6 +2960,7 @@ function refresh() {
29602960 } ) ;
29612961}
29622962
2963+ live_data_buffer = { positions :{ position :[ ] } }
29632964function liveData ( ) {
29642965 client . onConnectionLost = onConnectionLost ;
29652966 client . onMessageArrived = onMessageArrived ;
@@ -3022,7 +3023,7 @@ function liveData() {
30223023 if ( ( dateNow - new Date ( frame . time_received ) . getTime ( ) ) < 30000 ) {
30233024 var test = formatData ( frame , true ) ;
30243025 if ( clientActive ) {
3025- update ( test ) ;
3026+ live_data_buffer . positions . position . push . apply ( live_data_buffer . positions . position , test . positions . position )
30263027 }
30273028 $ ( "#stTimer" ) . attr ( "data-timestamp" , dateNow ) ;
30283029 $ ( "#stText" ) . text ( "websocket |" ) ;
@@ -3039,6 +3040,11 @@ function liveData() {
30393040 } ;
30403041}
30413042
3043+ setInterval ( function ( ) {
3044+ update ( live_data_buffer ) ;
3045+ live_data_buffer . positions . position = [ ] ;
3046+ } , 200 )
3047+
30423048function refreshSingle ( serial ) {
30433049 if ( ajax_inprogress_single ) {
30443050 clearTimeout ( periodical_focus ) ;
@@ -3694,11 +3700,11 @@ function update(response) {
36943700
36953701 // set the position based on the last record (oldest) returned from the server. Only provide minute accuracy to allow better hit rate with cloudfront
36963702 this_position_id = new Date ( row . gps_time ) ;
3697- this_position_id . setSeconds ( 0 )
3698- this_position_id . setMilliseconds ( 0 )
36993703
37003704 if ( new Date ( position_id ) < this_position_id || position_id == 0 ) {
37013705 if ( new Date ( ) > this_position_id ) {
3706+ this_position_id . setSeconds ( 0 )
3707+ this_position_id . setMilliseconds ( 0 )
37023708 position_id = this_position_id . toISOString ( )
37033709 }
37043710 }
@@ -3712,15 +3718,15 @@ function update(response) {
37123718 ctx . idx = max ;
37133719
37143720 if ( ctx . idx < ctx . max ) {
3715- setTimeout ( function ( ) { ctx . step ( ctx ) ; } , 4 ) ;
3721+ ctx . step ( ctx ) ;
37163722 } else {
37173723 ctx . list = Object . keys ( vehicles ) ;
3718- setTimeout ( function ( ) { ctx . draw ( ctx ) ; } , 16 ) ;
3724+ ctx . draw ( ctx ) ;
37193725 }
37203726 } ,
37213727 draw : function ( ctx ) {
37223728 if ( ctx . list . length < 1 ) {
3723- setTimeout ( function ( ) { ctx . end ( ctx ) ; } , 16 ) ;
3729+ ctx . end ( ctx ) ;
37243730 return ;
37253731 }
37263732
@@ -3744,7 +3750,7 @@ function update(response) {
37443750 }
37453751
37463752 // step to the next callsign
3747- setTimeout ( function ( ) { ctx . draw ( ctx ) ; } , 16 ) ;
3753+ ctx . draw ( ctx ) ;
37483754 } ,
37493755 end : function ( ctx ) {
37503756
0 commit comments