Documentation ¶
Index ¶
- Variables
- type Config
- type G
- type HandleCloseFunc
- type HandleEmptyFunc
- type HandleErrorFunc
- type HandleFilterFunc
- type HandleMessageFunc
- type HandleSessionFunc
- type Packet
- type Server
- func (w *Server) Broadcast(msg []byte) error
- func (w *Server) BroadcastBinary(msg []byte) error
- func (w *Server) BroadcastBinaryExcept(msg []byte, s *Session) error
- func (w *Server) BroadcastBinaryFilter(msg []byte, fn func(*Session) bool) error
- func (w *Server) BroadcastBinaryMultiple(msg []byte, ss []*Session) error
- func (w *Server) BroadcastExcept(msg []byte, s *Session) error
- func (w *Server) BroadcastFilter(msg []byte, fn func(*Session) bool) error
- func (w *Server) BroadcastMultiple(msg []byte, ss []*Session) error
- func (w *Server) Close() error
- func (w *Server) CloseWithMsg(msg []byte) error
- func (w *Server) FmtCloseMsg(code int, text string) []byte
- func (w *Server) GetSessionById(id string) *Session
- func (w *Server) HandleClose(fn HandleCloseFunc)
- func (w *Server) HandleConnect(fn HandleSessionFunc)
- func (w *Server) HandleDisconnect(fn HandleSessionFunc)
- func (w *Server) HandleError(fn HandleErrorFunc)
- func (w *Server) HandleMessage(fn HandleMessageFunc)
- func (w *Server) HandleMessageBinary(fn HandleMessageFunc)
- func (w *Server) HandleRequest(writer http.ResponseWriter, r *http.Request) error
- func (w *Server) HandleRequestWithKeys(writer http.ResponseWriter, r *http.Request, keys map[string]interface{}) error
- func (w *Server) HandleSent(fn HandleMessageFunc)
- func (w *Server) HandleSentBinary(fn HandleMessageFunc)
- func (w *Server) HandleShutdown(fn HandleEmptyFunc)
- func (w *Server) IsClosed() bool
- func (w *Server) Len() int
- func (w *Server) ReplaceSessionById(session *Session, id string)
- type Session
- func (s *Session) Close() error
- func (s *Session) CloseWithMsg(msg []byte) error
- func (s *Session) Get(key string) (interface{}, bool)
- func (s *Session) GetId() string
- func (s *Session) IsClosed() bool
- func (s *Session) LocalAddr() net.Addr
- func (s *Session) MustGet(key string) interface{}
- func (s *Session) Ping() error
- func (s *Session) Pong() error
- func (s *Session) RemoteAddr() net.Addr
- func (s *Session) Set(key string, val interface{})
- func (s *Session) Write(msg []byte) error
- func (s *Session) WriteBinary(msg []byte) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // 写超时 WriteTimeout time.Duration TTLTimeout time.Duration // 一个消息最大的size MaxMessageSize int64 // session消息最大的数量 MessageBufferSize int }
func DefaultConfig ¶
func DefaultConfig() *Config
type G ¶
type G struct {
// contains filtered or unexported fields
}
func (*G) GetSessionById ¶
func (*G) ReplaceSessionById ¶
替换session
type HandleCloseFunc ¶
type HandleEmptyFunc ¶
type HandleEmptyFunc func()
type HandleErrorFunc ¶
type HandleFilterFunc ¶
type HandleMessageFunc ¶
type HandleSessionFunc ¶
type HandleSessionFunc func(*Session)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) BroadcastBinary ¶
func (*Server) BroadcastBinaryExcept ¶
func (*Server) BroadcastBinaryFilter ¶
binary broadcast
func (*Server) BroadcastBinaryMultiple ¶
func (*Server) BroadcastFilter ¶
广播
func (*Server) BroadcastMultiple ¶
func (*Server) CloseWithMsg ¶
func (*Server) GetSessionById ¶
func (*Server) HandleClose ¶
func (w *Server) HandleClose(fn HandleCloseFunc)
func (*Server) HandleConnect ¶
func (w *Server) HandleConnect(fn HandleSessionFunc)
func (*Server) HandleDisconnect ¶
func (w *Server) HandleDisconnect(fn HandleSessionFunc)
func (*Server) HandleError ¶
func (w *Server) HandleError(fn HandleErrorFunc)
func (*Server) HandleMessage ¶
func (w *Server) HandleMessage(fn HandleMessageFunc)
func (*Server) HandleMessageBinary ¶
func (w *Server) HandleMessageBinary(fn HandleMessageFunc)
func (*Server) HandleRequest ¶
func (*Server) HandleRequestWithKeys ¶
func (*Server) HandleSent ¶
func (w *Server) HandleSent(fn HandleMessageFunc)
func (*Server) HandleSentBinary ¶
func (w *Server) HandleSentBinary(fn HandleMessageFunc)
func (*Server) HandleShutdown ¶
func (w *Server) HandleShutdown(fn HandleEmptyFunc)
func (*Server) ReplaceSessionById ¶
type Session ¶
type Session struct { Request *http.Request Keys map[string]interface{} // contains filtered or unexported fields }
func (*Session) CloseWithMsg ¶
func (*Session) RemoteAddr ¶
func (*Session) WriteBinary ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.