chat

package
v0.0.0-...-291a581 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Route

func Route(router *gin.Engine, token *config.Token)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(hub *Hub, connection *websocket.Conn, clientUser *user.User) *Client

func (*Client) Read

func (client *Client) Read()

func (*Client) Write

func (client *Client) Write()

type ClientMessage

type ClientMessage struct {
	Message []byte
	Sender  *Client
}

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub(token *config.Token) Hub

func (*Hub) Run

func (hub *Hub) Run()

func (*Hub) Serve

func (hub *Hub) Serve(ctx *gin.Context)

type Message

type Message struct {
	Type string `json:"type"`

	// message
	AvatarUrl string `json:"avatar_url,omitempty"`
	Message   string `json:"message,omitempty"`

	// video
	Audio string `json:"audio,omitempty"`
	Video string `json:"video,omitempty"`
}

func NewMessage

func NewMessage(sender *user.User, message string) Message

func NewVideoMessage

func NewVideoMessage(sender *user.User, videoId string) (Message, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL