Send ping frame using specified encoding
If base-64 encoding was requested, send the ping frame as a 0-length text frame, rather than as a 0-length binary frame.
This commit is contained in:
		@@ -143,10 +143,16 @@ func messageCopy(ws *websocket.Conn, r io.Reader, base64Encode, ping bool, timeo
 | 
			
		||||
	buf := make([]byte, 2048)
 | 
			
		||||
	if ping {
 | 
			
		||||
		resetTimeout(ws, timeout)
 | 
			
		||||
		if base64Encode {
 | 
			
		||||
			if err := websocket.Message.Send(ws, ""); err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			if err := websocket.Message.Send(ws, []byte{}); err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	for {
 | 
			
		||||
		resetTimeout(ws, timeout)
 | 
			
		||||
		n, err := r.Read(buf)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user