chat

package
v0.0.0-...-39a0b88 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebsocketChatHandler

func WebsocketChatHandler(hub *Hub, w http.ResponseWriter, r *http.Request)

Types

type Client

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

func NewClient

func NewClient(hub *Hub, conn *websocket.Conn, send chan []byte) *Client

type Hub

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

type Message

type Message struct {
	Sender    string `json:"sender"`
	Receiver  string `json:"receiver"`
	Timestamp string `json:"timestamp"`
	Body      string `json:"body"`
}

func (*Message) String

func (m *Message) String() string

type Server

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

func NewServer

func NewServer() *Server

func (*Server) GetAllChats

func (s *Server) GetAllChats(ctx context.Context, uuid string) ([]string, error)

func (*Server) GetDialog

func (s *Server) GetDialog(_ context.Context, client, target string) *Hub

type Store

type Store interface {
	SaveChat(ctx context.Context, uuid1, uuid2 string) error
	GetChat(ctx context.Context, uuid1, uuid2 string) error
	GetAllChats(ctx context.Context, uuid string) ([]string, error)
	SaveMessage(ctx context.Context, m *Message) error
	LoadAllMessages(ctx context.Context, uuid1, uuid2 string) ([]*Message, error)
}

Jump to

Keyboard shortcuts

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