feat: 接线上行帧分发到 message/identity/presence/group
This commit is contained in:
+6
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user