aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket/frames.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-03-12 14:18:06 +0700
committerShulhan <ms@kilabit.info>2019-03-12 14:18:06 +0700
commitd7367ec27c04920fc5cb9ef0b1aad140ceac3080 (patch)
tree92433cad5cd34025b9d0a979ce0dca80cfbcef09 /lib/websocket/frames.go
parent7233d915b3051ffc996d755dc446563bc94f3a7c (diff)
downloadpakakeh.go-d7367ec27c04920fc5cb9ef0b1aad140ceac3080.tar.xz
websocket: export the opcode type
The opcode type is required to create new frame and to get the opcode in continous frames.
Diffstat (limited to 'lib/websocket/frames.go')
-rw-r--r--lib/websocket/frames.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/websocket/frames.go b/lib/websocket/frames.go
index b54346b9..6a71a9ce 100644
--- a/lib/websocket/frames.go
+++ b/lib/websocket/frames.go
@@ -70,7 +70,7 @@ func (frames *Frames) isClosed() bool {
return false
}
for x := 0; x < len(frames.v); x++ {
- if frames.v[x].opcode == opcodeClose {
+ if frames.v[x].opcode == OpcodeClose {
return true
}
}
@@ -80,9 +80,9 @@ func (frames *Frames) isClosed() bool {
//
// Opcode return the operation code of the first frame.
//
-func (frames *Frames) Opcode() opcode {
+func (frames *Frames) Opcode() Opcode {
if len(frames.v) == 0 {
- return opcodeCont
+ return OpcodeCont
}
return frames.v[0].opcode
}
@@ -105,12 +105,12 @@ func (frames *Frames) payload() (payload []byte) {
}
for x := 0; x < len(frames.v); x++ {
- if frames.v[x].opcode == opcodeClose {
+ if frames.v[x].opcode == OpcodeClose {
break
}
// Ignore control PING or PONG frame.
- if frames.v[x].opcode == opcodePing || frames.v[x].opcode == opcodePong {
+ if frames.v[x].opcode == OpcodePing || frames.v[x].opcode == OpcodePong {
continue
}