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,8 +143,14 @@ 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 err := websocket.Message.Send(ws, []byte{}); err != nil {
|
if base64Encode {
|
||||||
return err
|
if err := websocket.Message.Send(ws, ""); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := websocket.Message.Send(ws, []byte{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user