chat

package
v4.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

README

Chat Service

Chat service provides a generic store for implementing chat rooms attached to any type of objects. Chat rooms has IDs, active users and messages. Events are published on the micro event broker, and as such this service depends on the WebSocket service to forward these events to user's interfaces.

Chat Rooms

Chat Rooms are defined by a Uuid and a RoomType to ease the search. RoomType "attaches" a given room to a given application entity : Workspace, Node, User or Global (no entity).

Currently it is implemented on "nodes" to replace the legacy "meta.comments" plugin, providing one realtime chat per file or folder.

See the common/proto/chat/chat.proto file.

Service

ChatService provides a GRPC handler conforming to the following signature :

service ChatService {
    rpc PutRoom(PutRoomRequest) returns (PutRoomResponse);
    rpc DeleteRoom(DeleteRoomRequest) returns (DeleteRoomResponse);
    rpc ListRooms(ListRoomsRequest) returns (stream ListRoomsResponse);
    rpc ListMessages(ListMessagesRequest) returns (stream ListMessagesResponse);
    rpc PostMessage(PostMessageRequest) returns (PostMessageResponse);
}

There is no REST service currently for that, as the main interface for communication with clients goes directly from the UX to the grpc service through the websocket channel.

Storage

Current implementation stores all chats and messages in a BoltDB file located in [Application Data Dir]/chats.json.

Documentation

Overview

Package chat provides real-time chats linked to any topics for end users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(f dao.DAO, t dao.DAO, dryRun bool, status chan dao.MigratorStatus) (map[string]int, error)

func NewDAO

func NewDAO(ctx context.Context, o dao.DAO) (dao.DAO, error)

Types

type DAO

type DAO interface {
	dao.DAO
	// PutRoom creates a new ChatRoom
	PutRoom(ctx context.Context, room *chat.ChatRoom) (*chat.ChatRoom, error)
	// DeleteRoom deletes a whole ChatRoom
	DeleteRoom(ctx context.Context, room *chat.ChatRoom) (bool, error)
	// ListRooms lists all chat rooms with request criteria
	ListRooms(ctx context.Context, request *chat.ListRoomsRequest) ([]*chat.ChatRoom, error)
	// RoomByUuid loads a room by UUID
	RoomByUuid(ctx context.Context, byType chat.RoomType, roomUUID string) (*chat.ChatRoom, error)
	// ListMessages loads all message for a given room, with cursor information
	ListMessages(ctx context.Context, request *chat.ListMessagesRequest) ([]*chat.ChatMessage, error)
	// PostMessage appends a message to the list, generating a UUID if required.
	PostMessage(ctx context.Context, request *chat.ChatMessage) (*chat.ChatMessage, error)
	// UpdateMessage updates the content of a message. It must check that new message's author matches existing author.
	UpdateMessage(ctx context.Context, request *chat.ChatMessage, callback MessageMatcher) (*chat.ChatMessage, error)
	// DeleteMessage deletes a message by UUID
	DeleteMessage(ctx context.Context, message *chat.ChatMessage) error
	// CountMessages counts all messages in a ChatRoom
	CountMessages(ctx context.Context, room *chat.ChatRoom) (count int, e error)
}

type MessageMatcher added in v4.4.0

type MessageMatcher func(msg *chat.ChatMessage) (matches bool, filtered *chat.ChatMessage, err error)

Directories

Path Synopsis
Package grpc provides a Pydio GRPC service for managing chat rooms.
Package grpc provides a Pydio GRPC service for managing chat rooms.

Jump to

Keyboard shortcuts

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