ChatService

package
v0.0.0-...-a36a601 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chat

func Chat(rdb *redis.Client, channel string, content string) error

Types

type ChatService

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

func NewChatService

func NewChatService(firebaseApp *firebase.App,
	rdb *redis.Client,
	userRepo models.UserRepository,
	messageRepo models.MessageRepository,
	chatRepo models.ChatRepository,
) *ChatService

func (*ChatService) HandleWSError

func (cs *ChatService) HandleWSError(err error, message string, conn *websocket.Conn)

func (*ChatService) OnChannelMessage

func (cs *ChatService) OnChannelMessage(conn *websocket.Conn, user *models.User)

func (*ChatService) OnClientMessage

func (cs *ChatService) OnClientMessage(conn *websocket.Conn, user *models.User)

func (*ChatService) OnConnect

func (cs *ChatService) OnConnect(conn *websocket.Conn, user *models.User) error

func (*ChatService) OnDisconnect

func (cs *ChatService) OnDisconnect(conn *websocket.Conn, user *models.User) chan struct{}

func (*ChatService) SendNotification

func (cs *ChatService) SendNotification(message *models.Message)

type Client

type Client struct {
	User *models.User

	MessageChan chan redis.Message
	// contains filtered or unexported fields
}

func Connect

func Connect(rdb *redis.Client, user *models.User) (*Client, error)

Connect connect client to client channels on redis

func (*Client) Disconnect

func (c *Client) Disconnect() error

Jump to

Keyboard shortcuts

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