Simplify keepalive resets
Websocket resources should have their keepalive timers reset whenever a message comes in. This is a nicety that slightly reduces the amount of traffic we send when actively messaging. Previously this was handled by MessageReceiver, but it's a bit cleaner to just have the WebsocketResource add an extra 'message' event handler. // FREEBIE
This commit is contained in:
		
					parent
					
						
							
								5a8787f91a
							
						
					
				
			
			
				commit
				
					
						9be5efc571
					
				
			
		
					 3 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -134,8 +134,9 @@
 | 
			
		|||
                path       : opts.keepalive.path,
 | 
			
		||||
                disconnect : opts.keepalive.disconnect
 | 
			
		||||
            });
 | 
			
		||||
            this.resetKeepAliveTimer = keepalive.reset.bind(keepalive);
 | 
			
		||||
            socket.addEventListener('connect', this.resetKeepAliveTimer);
 | 
			
		||||
            var resetKeepAliveTimer = keepalive.reset.bind(keepalive);
 | 
			
		||||
            socket.addEventListener('connect', resetKeepAliveTimer);
 | 
			
		||||
            socket.addEventListener('message', resetKeepAliveTimer);
 | 
			
		||||
            socket.addEventListener('close', keepalive.stop.bind(keepalive));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue