mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	sync WS message is now kind of ping - if there's no ping from server we display error message
This commit is contained in:
		
							parent
							
								
									8766e9ae4a
								
							
						
					
					
						commit
						3e6acb17cc
					
				| @ -152,6 +152,7 @@ ws.onmessage = function (event) { | ||||
|     const message = JSON.parse(event.data); | ||||
| 
 | ||||
|     if (message.type === 'sync') { | ||||
|         lastPingTs = new Date().getTime(); | ||||
|         const data = message.data; | ||||
| 
 | ||||
|         if (data.notes_tree) { | ||||
| @ -170,3 +171,11 @@ ws.onmessage = function (event) { | ||||
|         changesToPushCountEl.html(message.changesToPushCount); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| let lastPingTs = new Date().getTime(); | ||||
| 
 | ||||
| setInterval(() => { | ||||
|     if (new Date().getTime() - lastPingTs > 5000) { | ||||
|         showError("No communication with server"); | ||||
|     } | ||||
| }, 3000); | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner