msg

package
v0.0.0-...-9f34937 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSchema

func NewSchema(opts ...apigraphql.Option) graphql.ExecutableSchema

NewSchema creates a graphql executable schema.

Types

type Connection

type Connection struct {
	ID          uuid.UUID
	Filter      model.MessageFilter
	Subscribers map[string]chan *model.Message
}

Connection 对应客户端连接,共享队列机制.连接在用户真正订阅时才会创建连接.

type PubSub

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

PubSub 订阅管理器

func NewPubSub

func NewPubSub(client redis.UniversalClient) *PubSub

func (*PubSub) AddConnBy

func (pb *PubSub) AddConnBy(id uuid.UUID, filter *model.MessageFilter) *Connection

func (*PubSub) GetConn

func (pb *PubSub) GetConn(ctx context.Context, connID uuid.UUID) (*Connection, error)

GetConn 从上下文获取客户端连接

func (*PubSub) GetFilter

func (pb *PubSub) GetFilter(ctx context.Context) (*model.MessageFilter, error)

func (*PubSub) RemoveConn

func (pb *PubSub) RemoveConn(ctx context.Context) error

RemoveConn 移除连接,忽略对于连接ID不匹配的错误

func (*PubSub) Start

func (pb *PubSub) Start(ctx context.Context) error

func (*PubSub) Stop

func (pb *PubSub) Stop(ctx context.Context) error

func (*PubSub) Subscribe

func (pb *PubSub) Subscribe(ctx context.Context, topic string) (chan *model.Message, error)

Subscribe 根据topic订阅消息.

type Resolver

type Resolver struct {
	*apigraphql.Resolver
}

func NewResolver

func NewResolver(opt ...apigraphql.Option) *Resolver

type Server

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

Server alert server, includes: API提醒服务,包括API及消息分发功能,可选服务包括: UI

func NewServer

func NewServer(cnf *conf.AppConfiguration) *Server

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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