Documentation ¶
Index ¶
- Variables
- func ConstructMessage(room, event, src, dst string, body string) *dto.Message
- func HandleData(c *Conn, msg *dto.Message)
- func SocketHandler(ctx *echo.Context, log *logrus.Entry, registry *service.Registry, ...) error
- type Conn
- func (c *Conn) Emit(msg *dto.Message)
- func (c *Conn) IsDialogExist(name string) bool
- func (c *Conn) Join(name string)
- func (c *Conn) Leave(name string)
- func (c *Conn) LeftChat(msg *dto.Message)
- func (c *Conn) ReadMessage(msg *dto.Message)
- func (c *Conn) SendFile(msg *dto.Message)
- func (c *Conn) SendMessage(msg *dto.Message)
- func (c *Conn) SendSticker(msg *dto.Message)
- type Dialog
- type DialogMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ConnManager Stores all Conn types by their uuid. ConnManager = struct { sync.Mutex Conns map[string]*Conn }{ Conns: make(map[string]*Conn), } )
View Source
var DialogManager = struct { sync.Mutex Rooms map[string]*Dialog }{ Rooms: make(map[string]*Dialog, 0), }
Stores all Dialog types by their name.
Functions ¶
func ConstructMessage ¶
Constructs and returns a new Message type.
func HandleData ¶
HandleData Handles incoming, error free messages.
Types ¶
type Conn ¶
type Conn struct { sync.Mutex Socket *websocket.Conn ID string Send chan dto.Message Dialogs map[string]string // contains filtered or unexported fields }
The Conn type represents a single client.
func NewConnection ¶
func NewConnection(ctx *echo.Context, log *logrus.Entry, registry *service.Registry, userID string) (*Conn, error)
NewConnection Upgrades an HTTP connection and creates a new Conn type.
func (*Conn) IsDialogExist ¶
IsDialogExist CheckDialog ...
type Dialog ¶
type Dialog struct { sync.Mutex Name string Members map[string]string Send chan *DialogMessage // contains filtered or unexported fields }
The Dialog type represents a communication channel.
type DialogMessage ¶
Message protocol used only with a room's Send channel.
Click to show internal directories.
Click to hide internal directories.