-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperation.go
More file actions
47 lines (36 loc) · 790 Bytes
/
Copy pathOperation.go
File metadata and controls
47 lines (36 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package gows
type Operation byte
// https://www.rfc-editor.org/rfc/rfc6455.txt
const (
OperationContinue Operation = 0x00
OperationText Operation = 0x01
OperationBinary Operation = 0x02
// Reserved Control Frames: 0x03-0x07
OperationClose Operation = 0x08
OperationPing Operation = 0x09
OperationPong Operation = 0x0a
// Reserved Control Frames: 0x0b-0x0f
)
func (operation Operation) IsControl() bool {
if operation&0x08 != 0 {
return true
}
return false
}
func (operation Operation) IsValid() bool {
switch operation {
case OperationContinue:
return true
case OperationText:
return true
case OperationBinary:
return true
case OperationClose:
return true
case OperationPing:
return true
case OperationPong:
return true
}
return false
}