good morning!!!!

Skip to content
Snippets Groups Projects
opcode.go 481 B
Newer Older
package websocket
Anmol Sethi's avatar
Anmol Sethi committed

// opcode represents a WebSocket Opcode.
type opcode int
//go:generate go run golang.org/x/tools/cmd/stringer -type=opcode
Anmol Sethi's avatar
Anmol Sethi committed

// opcode constants.
const (
	opContinuation opcode = iota
	opText
	opBinary
	// 3 - 7 are reserved for further non-control frames.
Anmol Sethi's avatar
Anmol Sethi committed
	opPing
	opPong
	// 11-16 are reserved for further control frames.
)
Anmol Sethi's avatar
Anmol Sethi committed

func (o opcode) controlOp() bool {
	switch o {
	case opClose, opPing, opPong:
		return true
	}
	return false
}