feat: Hub接收RESTful API的消息
This commit is contained in:
@ -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")
|
||||
|
||||
Reference in New Issue
Block a user