biz

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlatformWeb = "web"
)

Variables

This section is empty.

Functions

func EncodeRoomKey

func EncodeRoomKey(t, room string) string

Types

type Endpoint

type Endpoint func(ctx context.Context, info *Info) (res bool, err error)

Endpoint 若res为true, 则表示消息可以继续发送

type EndpointContainer

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

func (*EndpointContainer) Invoke

func (c *EndpointContainer) Invoke(ctx context.Context, info *Info) (res bool, err error)

type Info

type Info struct {
	ReceiverId uint64
	Priority   int8
}

type LogicHandler

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

func (*LogicHandler) Connect

func (h *LogicHandler) Connect(ctx context.Context, server string, token []byte) (memberId uint64, key string,
	roomId string, accepts []int32, hb int64, err error)

Connect 验证用户数据

func (*LogicHandler) Disconnect

func (h *LogicHandler) Disconnect(ctx context.Context, memberId uint64, key, server string) (has bool, err error)

func (*LogicHandler) HandleChat

func (h *LogicHandler) HandleChat(ctx context.Context, m *protocol.Message) (ackMsg *protocol.Message, err error)

func (*LogicHandler) HandleGroupChat

func (h *LogicHandler) HandleGroupChat(ctx context.Context, memberId uint64, m *protocol.Message) (ackMsg *protocol.Message, err error)

func (*LogicHandler) Heartbeat

func (h *LogicHandler) Heartbeat(ctx context.Context, memberId uint64, key, server string) (err error)

func (*LogicHandler) NodeInstance

func (h *LogicHandler) NodeInstance(ctx context.Context) (string, error)

func (*LogicHandler) Receive

func (h *LogicHandler) Receive(ctx context.Context, memberId uint64, m *protocol.Message) (ackMsg *protocol.Message, err error)

func (*LogicHandler) RenewOnline

func (h *LogicHandler) RenewOnline(ctx context.Context, server string, roomCount map[string]int32) (map[string]int32, error)

type LogicRepo

type LogicRepo interface {
	AddMapping(ctx context.Context, memberId uint64, key, server string) error
	ExpireMapping(ctx context.Context, memberId uint64, key string) (has bool, err error)
	DelMapping(ctx context.Context, memberId uint64, key, server string) (bool, error)
	//GetMapping(ctx context.Context, memberId uint64) (map[string]string, error)
	PushOfflineMsg(ctx context.Context, op int32, mids []uint64, msg []byte) error
	ServersByKeys(ctx context.Context, keys []string) ([]string, error)
	KeysByMids(ctx context.Context, mids []uint64) (map[string]string, []uint64, []uint64, error)
	AddServerOnline(ctx context.Context, server string, online *Online) error
	ServerOnline(ctx context.Context, server string) (*Online, error)
	DelServerOnline(ctx context.Context, server string) error
	StoreChatMessage(ctx context.Context, seq uint32, chatMessage *protocol.ChatSendMessage) error
	StoreGroupChatMessage(ctx context.Context, seq uint32, groupChatMessage *protocol.GroupChatMessage) ([]uint64, error)
	DeleteGroupChatOfflineMessage(ctx context.Context, groupId, userId, messageId uint64) error
	//PushChatMessageToKafka(ctx context.Context, chatMessage *protocol.ChatSendMessage)
	PushMessage(ctx context.Context, dm *protocol.DispatcherMessage)
}

type NodeInstance

type NodeInstance struct {
	Region   string
	Zone     string
	Env      string
	AppID    string
	Hostname string
	Addrs    []string
	Version  string
	LastTs   int64
	Metadata map[string]string
}

type Online

type Online struct {
	Server    string
	RoomCount map[string]int32
	Updated   int64
}

Jump to

Keyboard shortcuts

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