feat: Hub接收RESTful API的消息

This commit is contained in:
2025-12-16 17:15:59 +08:00
parent 18874711ea
commit b824dc3792
6 changed files with 74 additions and 7 deletions

View File

@ -10,16 +10,20 @@ import (
"time"
"git.jinshen.cn/remilia/push-server/interval/api"
"git.jinshen.cn/remilia/push-server/interval/hub"
"git.jinshen.cn/remilia/push-server/interval/server"
)
func main() {
_, serverCancel := context.WithCancel(context.Background())
serverCtx, serverCancel := context.WithCancel(context.Background())
defer func() {
serverCancel()
}()
httpServer := server.NewHTTPServer(":8080", api.NewRouter())
h := hub.NewHub()
go h.Run(serverCtx)
httpServer := server.NewHTTPServer(":8080", api.NewRouter(h))
go func() {
log.Println("Starting HTTP server on :8080")