Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CloseFrame = fmt.Errorf("Received close Frame")
View Source
var ErrInvalidCloseStatus = fmt.Errorf("Received invalid close status")
View Source
var ErrInvalidFragment = fmt.Errorf("Received invalid fragmentation")
View Source
var ErrInvalidOpCode = fmt.Errorf("Received invalid OpCode")
View Source
var ErrInvalidPayload = fmt.Errorf("Received invalid utf8 payload")
View Source
var ErrInvalidSize = fmt.Errorf("Received invalid payload size")
View Source
var ErrReservedBits = fmt.Errorf("Received reserved bits")
View Source
var ErrTooLongControlFrame = fmt.Errorf("Received a control frame that is fragmented or too long")
View Source
var ErrUnexpectedContinuation = fmt.Errorf("Received unexpected continuation frame")
View Source
var ErrUnmaskedFrame = fmt.Errorf("Received unmasked frame")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Protocol string // choosen protocol (Sec-WebSocket-Protocol) Arguments [][]string // URI parameters, index 0 is full URI, then matching groups Store interface{} // store (for client implementation-specific data) }
Represents available information about a client
type Controller ¶
type Controller struct { URI *parser.Scheme // uri scheme Fun ControllerFunc // controller function }
Represents a websocket controller
type ControllerFunc ¶
Represents a websocket controller callback function
type ControllerSet ¶
type ControllerSet struct { Def *Controller // default controller Uri []*Controller // uri controllers }
Represents a controller set
func (*ControllerSet) Match ¶
func (s *ControllerSet) Match(uri string) (*Controller, [][]string)
Match finds a controller for a given URI also it returns the matching string patterns
type Message ¶
type Message struct { Final bool Type MessageType Size uint Data []byte }
Represents a websocket message
type MessageError ¶
type MessageError uint16
Lists websocket close status
const ( NONE MessageError = 0 NORMAL MessageError = 1000 GOING_AWAY MessageError = 1001 PROTOCOL_ERR MessageError = 1002 UNACCEPTABLE_OPCODE MessageError = 1003 INVALID_PAYLOAD MessageError = 1007 // utf8 MESSAGE_TOO_LARGE MessageError = 1009 )
type MessageType ¶
type MessageType byte
Lists websocket message types
const ( CONTINUATION MessageType = 0x00 TEXT MessageType = 0x01 BINARY MessageType = 0x02 CLOSE MessageType = 0x08 PING MessageType = 0x09 PONG MessageType = 0x0a )
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Represents a websocket server
func CreateServer ¶
CreateServer creates a server for a specific HOST and PORT
func (*Server) Bind ¶
func (s *Server) Bind(uri string, f ControllerFunc) error
Bind binds a controller to an URI scheme
func (*Server) BindDefault ¶
func (s *Server) BindDefault(f ControllerFunc)
BindDefault binds a default controller it will be called if the URI does not match another controller
Click to show internal directories.
Click to hide internal directories.