Documentation ¶
Index ¶
- Constants
- Variables
- func ResponseStart(service *cham.Service, args ...interface{}) cham.Dispatch
- func Start(service *cham.Service, args ...interface{}) cham.Dispatch
- type Backend
- type Conf
- type Gate
- type Option
- type TcpBackend
- type Websocket
- func (ws *Websocket) Close(code uint16, reason []byte)
- func (ws *Websocket) Recv() ([]byte, error)
- func (ws *Websocket) RecvFrame() (final bool, message []byte, err error)
- func (ws *Websocket) SendBinary(data []byte) error
- func (ws *Websocket) SendFrame(fin bool, opcode byte, data []byte) error
- func (ws *Websocket) SendPing(data []byte) error
- func (ws *Websocket) SendPong(data []byte) error
- func (ws *Websocket) SendText(data []byte) error
- func (ws *Websocket) Start()
- type WebsocketBackend
- type WsDefaultHandler
- func (wd WsDefaultHandler) CheckOrigin(origin, host string) bool
- func (wd WsDefaultHandler) OnClose(ws *Websocket, code uint16, reason []byte)
- func (wd WsDefaultHandler) OnMessage(ws *Websocket, message []byte)
- func (wd WsDefaultHandler) OnOpen(ws *Websocket)
- func (wd WsDefaultHandler) OnPong(ws *Websocket, data []byte)
- type WsHandler
Constants ¶
View Source
const ( OPEN uint8 = iota KICK )
View Source
const ( OnOpen uint8 = iota OnMessage OnClose OnPong )
Variables ¶
View Source
var ( ErrUpgrade = errors.New("Can \"Upgrade\" only to \"WebSocket\"") ErrConnection = errors.New("\"Connection\" must be \"Upgrade\"") ErrCrossOrigin = errors.New("Cross origin websockets not allowed") ErrSecVersion = errors.New("HTTP/1.1 Upgrade Required\r\nSec-WebSocket-Version: 13\r\n\r\n") ErrSecKey = errors.New("\"Sec-WebSocket-Key\" must not be nil") ErrHijacker = errors.New("Not implement http.Hijacker") )
Functions ¶
Types ¶
type TcpBackend ¶
type TcpBackend struct {
// contains filtered or unexported fields
}
func (*TcpBackend) Close ¶
func (t *TcpBackend) Close()
func (*TcpBackend) Write ¶
func (t *TcpBackend) Write(data []byte) (err error)
type Websocket ¶
type Websocket struct {
// contains filtered or unexported fields
}
func NewWebsocket ¶
func (*Websocket) SendBinary ¶
type WebsocketBackend ¶
type WebsocketBackend struct {
*Websocket
}
func (*WebsocketBackend) Close ¶
func (w *WebsocketBackend) Close()
func (*WebsocketBackend) Write ¶
func (w *WebsocketBackend) Write(data []byte) error
type WsDefaultHandler ¶
type WsDefaultHandler struct {
// contains filtered or unexported fields
}
func (WsDefaultHandler) CheckOrigin ¶
func (wd WsDefaultHandler) CheckOrigin(origin, host string) bool
func (WsDefaultHandler) OnClose ¶
func (wd WsDefaultHandler) OnClose(ws *Websocket, code uint16, reason []byte)
func (WsDefaultHandler) OnMessage ¶
func (wd WsDefaultHandler) OnMessage(ws *Websocket, message []byte)
func (WsDefaultHandler) OnOpen ¶
func (wd WsDefaultHandler) OnOpen(ws *Websocket)
func (WsDefaultHandler) OnPong ¶
func (wd WsDefaultHandler) OnPong(ws *Websocket, data []byte)
Click to show internal directories.
Click to hide internal directories.