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)
 | 
						buf := make([]byte, 2048)
 | 
				
			||||||
	if ping {
 | 
						if ping {
 | 
				
			||||||
		resetTimeout(ws, timeout)
 | 
							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 {
 | 
								if err := websocket.Message.Send(ws, []byte{}); err != nil {
 | 
				
			||||||
				return err
 | 
									return err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	for {
 | 
						for {
 | 
				
			||||||
		resetTimeout(ws, timeout)
 | 
							resetTimeout(ws, timeout)
 | 
				
			||||||
		n, err := r.Read(buf)
 | 
							n, err := r.Read(buf)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user