feat: 接线上行帧分发到 message/identity/presence/group

This commit is contained in:
Nixevol
2026-09-30 08:07:16 +08:00
parent 0efcfbb8b6
commit b8569b0708
5 changed files with 805 additions and 22 deletions
+6 -2
View File
@@ -88,7 +88,6 @@ func runServe(ctx context.Context, cfg config.Config) error {
uplink := &appUplink{
msg: msgApp,
conns: memConns,
next: port.StubUplinkHandler{},
log: slog.Default(),
}
sess := broker.NewSession(broker.SessionOptions{
@@ -128,6 +127,7 @@ func runServe(ctx context.Context, cfg config.Config) error {
message.WithDownlink(brk),
)
uplink.msg = msgApp
uplink.down = brk
presApp := presence.New(presence.Config{
DB: db,
@@ -135,6 +135,7 @@ func runServe(ctx context.Context, cfg config.Config) error {
Conns: &presenceConnTable{conns: memConns},
})
sess.SetPresence(presApp)
uplink.presence = presApp
idApp := identity.New(identity.Config{
DB: db,
@@ -145,13 +146,16 @@ func runServe(ctx context.Context, cfg config.Config) error {
Logger: slog.Default(),
ConnControl: brk,
})
_ = group.New(group.Config{
uplink.identity = idApp
groupApp := group.New(group.Config{
DB: db,
Talk: idApp,
Online: presApp,
Downlink: brk,
MaxGroupMembers: cfg.Limits.MaxGroupMembers,
})
uplink.groups = groupApp
if recoverErr := msgApp.RecoverOnStart(ctx); recoverErr != nil {
return fmt.Errorf("message recover: %w", recoverErr)