RFC 6455 states, that Ping frame payload is optional:
https://tools.ietf.org/html/rfc6455#section-5.5.2:
A Ping frame MAY include "Application data".
However, the protocol implementation reads a frame using io.ReadFull, that returns
io.EOF error, if no bytes are read, and this io.EOF is treated as an error on the next
line.
The following patch solves this issue:
--- hybi.go.backup 2014-04-20 17:03:27.811047258 +0700
+++ hybi.go 2014-04-20 17:30:58.371147981 +0700
@@ -291,7 +291,7 @@
case PingFrame:
pingMsg := make([]byte, maxControlFramePayloadLength)
n, err := io.ReadFull(frame, pingMsg)
- if err != nil && err != io.ErrUnexpectedEOF {
+ if err != nil && err != io.ErrUnexpectedEOF && err !=
io.EOF {
return nil, err
}
io.Copy(ioutil.Discard, frame)
by opennota: