Documentation ¶
Index ¶
- func EventHandler(msg *common.Message, ctx *Context)
- type Broadcast
- type Connection
- type Context
- type DataHandler
- type EventFunc
- type Room
- type Session
- type Sockets
- func (s *Sockets) Broadcast(event string, data, options interface{})
- func (s *Sockets) BroadcastToRoom(roomName, event string, data interface{}, ctx *Context)
- func (s *Sockets) BroadcastToRoomChannel(roomName, channelName, event string, data interface{}, ctx *Context)
- func (s *Sockets) CheckIfSessionExists(username string) bool
- func (s *Sockets) Close()
- func (s *Sockets) GetUserRoom(username, uuid string) (string, error)
- func (s *Sockets) HandleConnection(w http.ResponseWriter, r *http.Request) error
- func (s *Sockets) HandleEvent(pattern string, handler EventFunc)
- func (s *Sockets) InterruptHandler()
- func (s *Sockets) JoinRoom(room, uuid string) error
- func (s *Sockets) JoinRoomChannel(channel, uuid string) error
- func (s *Sockets) LeaveRoom(uuid string)
- func (s *Sockets) NewUserSession(username string, conn *Connection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventHandler ¶
Types ¶
type Connection ¶
type Connection struct { UUID string Conn *websocket.Conn Status bool `json:"status"` Room *Room `json:"room"` Data map[string]interface{} *Session }
func NewConnection ¶ added in v1.4.0
func NewConnection() *Connection
func (*Connection) AddSession ¶ added in v1.4.0
func (c *Connection) AddSession(session *Session)
func (*Connection) ClearSession ¶ added in v1.4.0
func (c *Connection) ClearSession(session *Session)
func (*Connection) Emit ¶ added in v1.4.0
func (c *Connection) Emit(msg interface{}) error
func (*Connection) GetData ¶ added in v1.7.0
func (c *Connection) GetData(key string) interface{}
func (*Connection) SetData ¶ added in v1.7.0
func (c *Connection) SetData(key string, value interface{})
type Context ¶
type Context struct { *Connection UUID string }
type DataHandler ¶
type Session ¶ added in v1.4.0
func (*Session) HasSession ¶ added in v1.6.0
type Sockets ¶
type Sockets struct { Connections map[string]*Connection Sessions map[string]*Session sync.Mutex // contains filtered or unexported fields }
func New ¶
func New(handler DataHandler) *Sockets
func (*Sockets) BroadcastToRoom ¶
func (*Sockets) BroadcastToRoomChannel ¶
func (*Sockets) CheckIfSessionExists ¶ added in v1.4.0
func (*Sockets) HandleConnection ¶
func (*Sockets) HandleEvent ¶
func (*Sockets) InterruptHandler ¶
func (s *Sockets) InterruptHandler()
func (*Sockets) JoinRoomChannel ¶
func (*Sockets) NewUserSession ¶ added in v1.4.0
func (s *Sockets) NewUserSession(username string, conn *Connection)
Click to show internal directories.
Click to hide internal directories.