add Frame data (Opcode, etc)
This commit is contained in:
parent
bf58fc49e5
commit
d16a0830d0
|
@ -0,0 +1,34 @@
|
|||
package opcode
|
||||
|
||||
import (
|
||||
"git.xdrm.io/gws/internal/ws/frame"
|
||||
)
|
||||
|
||||
// Represents OpCode Values
|
||||
const (
|
||||
// frame continuation
|
||||
CONTINUATION frame.OpCode = 0x00
|
||||
|
||||
// frame type
|
||||
TEXT frame.OpCode = 0x01
|
||||
BINARY frame.OpCode = 0x02
|
||||
|
||||
// reserved for non-control frames
|
||||
RSV1 frame.OpCode = 0x03
|
||||
RSV2 frame.OpCode = 0x04
|
||||
RSV3 frame.OpCode = 0x05
|
||||
RSV4 frame.OpCode = 0x06
|
||||
|
||||
// connection close
|
||||
CLOSE frame.OpCode = 0x08
|
||||
|
||||
// ping pong
|
||||
PING frame.OpCode = 0x09
|
||||
PONG frame.OpCode = 0x0A
|
||||
|
||||
// reserved for control frames
|
||||
CRSV1 frame.OpCode = 0x0B
|
||||
CRSV2 frame.OpCode = 0x0C
|
||||
CRSV3 frame.OpCode = 0x0D
|
||||
CRSV4 frame.OpCode = 0x0E
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
package frame
|
||||
|
||||
// Represents an OpCode
|
||||
type OpCode byte
|
||||
|
||||
|
||||
|
||||
// Represents a frame metadata
|
||||
type Header struct {
|
||||
fin bool
|
||||
opc OpCode
|
||||
msk []byte // len: 4 if set, else empty
|
||||
}
|
Loading…
Reference in New Issue