handlers

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveUsersRepo added in v0.3.0

type ActiveUsersRepo interface {
	Add(userId uuid.UUID) error
	Delete(userId uuid.UUID) error
	Count() int
}

type Chat added in v0.4.0

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

func NewChat added in v0.4.0

func NewChat(h *Hub, a ActiveUsersRepo, t TokensRepo, m MessagesRepo) *Chat

func (*Chat) HandleChat added in v0.4.0

func (c *Chat) HandleChat(w http.ResponseWriter, r *http.Request, params server.WsRTMStartParams)

func (*Chat) Run added in v0.5.0

func (c *Chat) Run()

type Client added in v0.4.0

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

Client is a middleman between the websocket connection and the hub.

type Hub added in v0.4.0

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

Hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub added in v0.4.0

func NewHub() *Hub

func (*Hub) Run added in v0.4.0

func (h *Hub) Run()

type Message added in v0.4.0

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

type MessagesRepo added in v0.4.0

type MessagesRepo interface {
	Create(msg models.Message) (models.Message, error)
	GetAfterDateExcludingUserId(after time.Time, userId uuid.UUID) ([]models.Message, error)
}

type TokensRepo added in v0.3.0

type TokensRepo interface {
	Create(token models.Token) (models.Token, error)
	Get(id uuid.UUID) (models.Token, error)
	InvalidateByUserId(userId uuid.UUID) error
}

type Users

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

func NewUsers

func NewUsers(u UsersRepo, a ActiveUsersRepo, t TokensRepo) *Users

func (*Users) HandleUserActive added in v0.3.0

func (u *Users) HandleUserActive(w http.ResponseWriter, r *http.Request)

func (*Users) HandleUserCreate

func (u *Users) HandleUserCreate(w http.ResponseWriter, r *http.Request)

func (*Users) HandleUserLogin

func (u *Users) HandleUserLogin(w http.ResponseWriter, r *http.Request)

type UsersRepo

type UsersRepo interface {
	Create(user models.User) (models.User, error)
	GetByUserName(userName string) (models.User, error)
}

Jump to

Keyboard shortcuts

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