aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket/frames.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-03-06 14:58:29 +0700
committerShulhan <ms@kilabit.info>2019-03-06 14:58:29 +0700
commit466a405d24b511b07f4f12cd2cc5aada25fd7f24 (patch)
treedd515730b5733cb311acea9cc2690c2af7b054a2 /lib/websocket/frames.go
parent3235cd514a6052a5a163f6658a944a77d814158f (diff)
downloadpakakeh.go-466a405d24b511b07f4f12cd2cc5aada25fd7f24.tar.xz
websocket: explain why Unpack return multiple frames
When receiving packet from client, the underlying protocol or operating system may buffered the packet. Client may send a single frame one at time, but server may receive one or more frame in one packet; and vice versa. That's the reason why the Unpack return multiple frame instead of single frame.
Diffstat (limited to 'lib/websocket/frames.go')
-rw-r--r--lib/websocket/frames.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/websocket/frames.go b/lib/websocket/frames.go
index 2f9dd239..c1ebc4b5 100644
--- a/lib/websocket/frames.go
+++ b/lib/websocket/frames.go
@@ -19,6 +19,12 @@ type Frames struct {
//
// Unpack websocket data protocol from raw bytes to one or more frames.
//
+// When receiving packet from client, the underlying protocol or operating
+// system may buffered the packet. Client may send a single frame one at
+// time, but server may receive one or more frame in one packet; and vice
+// versa. That's the reason why the Unpack return multiple frame instead of
+// single frame.
+//
// On success it will return one or more frames.
// On fail it will return zero frame.
//