v13

package
v0.0.0-...-a211f75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpContinuation = 0
	OpText         = 1
	OpBinary       = 2
	OpClose        = 8
	OpPing         = 9
	OpPong         = 10
)
View Source
const (
	CloseNormalClosure       = 1000
	CloseGoingAway           = 1001
	CloseProtocolError       = 1002
	CloseUnsupportedData     = 1003
	CloseNoStatusReceived    = 1005
	CloseAbnormalClosure     = 1006
	CloseInvalidFramePayload = 1007
	ClosePolicyViolation     = 1008
	CloseMessageTooBig       = 1009
	CloseMandatoryExtension  = 1010
	CloseInternalError       = 1011
	CloseServiceRestart      = 1012
	CloseTryAgainLater       = 1013
	CloseTLSHandshake        = 1015
)

Variables

This section is empty.

Functions

func Demo

func Demo()

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(conn net.Conn) *Connection

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Read

func (c *Connection) Read() (messageType byte, message []byte, err error)

func (*Connection) Write

func (c *Connection) Write(messageType byte, message []byte) error

type Frame

type Frame struct {
	Fin     bool
	Opcode  byte
	Mask    bool
	MaskKey [4]byte
	Payload []byte
}

func NewCloseFrame

func NewCloseFrame(code uint16, reason string) *Frame

func NewFrame

func NewFrame(fin bool, opcode byte, mask bool, maskKey [4]byte, payload []byte) *Frame

func NewTextFrame

func NewTextFrame(payload []byte) *Frame

func ReadFrame

func ReadFrame(br *bufio.Reader) (*Frame, error)

func (Frame) Bytes

func (f Frame) Bytes() []byte

func (Frame) MaskPayload

func (f Frame) MaskPayload()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL