go-websocket-frames
A codec for websocket
for exchanging multi-part binary messages.
Protocol
+-------------------------------------+
| LEN = number of frames (uint32, BE) |
+-------------------------------------+-----------------------+
| N = frame size (uint32, BE) | frame (N bytes long) |
+-------------------------------------+-----------------------+
| (LEN-1) frames follow | ... |
Example
import "github.com/tchap/go-websocket-frames/frames"
// Sender
data := [][]byte{
[]byte("first"),
[]byte("second"),
[]byte("third"),
[]byte("fourth"),
[]byte("fifth"),
}
frames.C.Send(conn, data)
// Receiver
var data [][]byte
frames.C.Receive(conn, &data)
Documentation
See the generated documentation at
GoDoc.
License
MIT, see the LICENSE
file.