Versions in this module Expand all Collapse all v0 v0.0.11 Oct 19, 2021 v0.0.10 Sep 28, 2021 Changes in this version + type Authentication struct + func (p *Authentication) Authenticate(r *http.Request, c *gin.Context, conn *websocket.Conn) (int, bool) + type AuthenticationI interface + Authenticate func(r *http.Request, c *gin.Context, conn *websocket.Conn) (int, bool) + type CodecI interface + Decode func([]byte) error + Encode func() ([]byte, error) + type Context struct + func NewContext(options ...CtxOption) *Context + func (p *Context) Close() error + func (p *Context) GetConn() *websocket.Conn + func (p *Context) GetHub() HubI + func (p *Context) GetId() int + func (p *Context) Go() + func (p *Context) HandShake(r *http.Request, c *gin.Context) bool + func (p *Context) Message(b []byte) + func (p *Context) Open(r *http.Request, c *gin.Context) bool + func (p *Context) Send(message []byte) + func (p *Context) SetUp(id int, conn *websocket.Conn, hub HubI) + type ContextConnI interface + Close func() error + GetConn func() *websocket.Conn + GetHub func() HubI + GetId func() int + Go func() + HandShake func(r *http.Request, c *gin.Context) bool + Open func(r *http.Request, c *gin.Context) bool + Send func(message []byte) + SetUp func(id int, conn *websocket.Conn, hub HubI) + type CtxOption func(c *Context) + func Codec(codec CodecI) CtxOption + func Handler(handler HandlerI) CtxOption + type DefaultHandler struct + func (p *DefaultHandler) Close(ctx ContextConnI) + func (p *DefaultHandler) HandShake(r *http.Request, c *gin.Context) bool + func (p *DefaultHandler) Message(ctx ContextConnI, msg []byte) + func (p *DefaultHandler) Open(r *http.Request, c *gin.Context) bool + type HandlerI interface + Close func(ctx ContextConnI) + HandShake func(r *http.Request, c *gin.Context) bool + Message func(ctx ContextConnI, msg []byte) + Open func(r *http.Request, c *gin.Context) bool + type Hub struct + Broadcast chan []byte + func NewHub(options ...HubOption) *Hub + func (h *Hub) FindContextConnById(id int) (ctx ContextConnI) + func (h *Hub) GetLogger() log.Logger + func (h *Hub) IdIsOnLine(id int) (onLine bool, ctx ContextConnI) + func (h *Hub) OnlineMapping() map[int]ContextConnI + func (h *Hub) Register(id int, i ContextConnI) + func (h *Hub) Serve(w http.ResponseWriter, r *http.Request, c *gin.Context, ...) + func (h *Hub) TotalOnline() int + func (h *Hub) UnRegister(id int) + type HubI interface + FindContextConnById func(id int) ContextConnI + GetLogger func() log.Logger + IdIsOnLine func(id int) (bool, ContextConnI) + Register func(id int, i ContextConnI) + TotalOnline func() int + UnRegister func(id int) + type HubOption func(c *Hub) + func Logger(logger log.Logger) HubOption