Documentation ¶
Index ¶
- Constants
- func RunTCPServer(opts *Options) error
- func RunWebsocketServer(opts *Options) error
- type Account
- type Accounts
- type AuthOptions
- type Conn
- type Handler
- type Options
- type Packet
- type ReadHandler
- type Server
- type Subscribe
- type TCPConn
- type TCPServer
- type Topic
- type Topics
- type WebsocketConn
- func (c *WebsocketConn) Accept()
- func (c *WebsocketConn) Close() error
- func (c *WebsocketConn) Closed() bool
- func (c *WebsocketConn) ConnID() string
- func (c *WebsocketConn) LocalAddr() net.Addr
- func (c *WebsocketConn) RemoteAddr() net.Addr
- func (c *WebsocketConn) Server() Server
- func (c *WebsocketConn) Write(data []byte) error
- type WebsocketOptions
- type WebsocketServer
Constants ¶
View Source
const (
HeadPackSizeLen = 4
)
Variables ¶
This section is empty.
Functions ¶
func RunTCPServer ¶
func RunWebsocketServer ¶
Types ¶
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
func NewAccounts ¶
func NewAccounts() *Accounts
func (*Accounts) AddAccount ¶
func (*Accounts) RemoveAccount ¶
type AuthOptions ¶
type Options ¶
type Options struct { Websocket *WebsocketOptions PingInterval time.Duration MaxPingOutTimes int Auth *AuthOptions }
func NewOptions ¶
func NewOptions() *Options
type ReadHandler ¶
type ReadHandler struct {
// contains filtered or unexported fields
}
func NewReadHandler ¶
func NewReadHandler(c Conn) *ReadHandler
func (*ReadHandler) Close ¶
func (r *ReadHandler) Close()
func (*ReadHandler) CreateConn ¶
func (r *ReadHandler) CreateConn()
func (*ReadHandler) ReadData ¶
func (r *ReadHandler) ReadData(data []byte) (err error)
type Subscribe ¶
type Subscribe struct {
// contains filtered or unexported fields
}
func NewSubscribe ¶
func NewSubscribe() *Subscribe
type TCPConn ¶
type TCPConn struct {
// contains filtered or unexported fields
}
func (*TCPConn) RemoteAddr ¶
type TCPServer ¶
type TCPServer struct {
// contains filtered or unexported fields
}
func (*TCPServer) ListenAndServe ¶
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
func (*Topic) BroadcastLoop ¶
func (t *Topic) BroadcastLoop()
func (*Topic) HaveAccount ¶
func (*Topic) UnSubscribe ¶
func (t *Topic) UnSubscribe(id interface{})
type WebsocketConn ¶
type WebsocketConn struct {
// contains filtered or unexported fields
}
func NewWebsocketConn ¶
func NewWebsocketConn(conn *websocket.Conn, srv Server) *WebsocketConn
func (*WebsocketConn) Accept ¶
func (c *WebsocketConn) Accept()
func (*WebsocketConn) Close ¶
func (c *WebsocketConn) Close() error
func (*WebsocketConn) Closed ¶
func (c *WebsocketConn) Closed() bool
func (*WebsocketConn) ConnID ¶
func (c *WebsocketConn) ConnID() string
func (*WebsocketConn) LocalAddr ¶
func (c *WebsocketConn) LocalAddr() net.Addr
func (*WebsocketConn) RemoteAddr ¶
func (c *WebsocketConn) RemoteAddr() net.Addr
func (*WebsocketConn) Server ¶
func (c *WebsocketConn) Server() Server
func (*WebsocketConn) Write ¶
func (c *WebsocketConn) Write(data []byte) error
type WebsocketOptions ¶
type WebsocketServer ¶
type WebsocketServer struct {
// contains filtered or unexported fields
}
func (*WebsocketServer) ListenAndServe ¶
func (srv *WebsocketServer) ListenAndServe() error
func (*WebsocketServer) Options ¶
func (srv *WebsocketServer) Options() *Options
func (*WebsocketServer) ServeHTTP ¶
func (srv *WebsocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.