mirror of
https://github.com/gotify/server.git
synced 2024-01-28 15:20:56 +03:00
Make ws ping interval configurable
This commit is contained in:
@@ -35,6 +35,7 @@ server:
|
|||||||
# - "Authorization"
|
# - "Authorization"
|
||||||
# - "content-type"
|
# - "content-type"
|
||||||
stream:
|
stream:
|
||||||
|
pingperiodseconds: 45 # the interval in which websocket pings will be sent. Only change this value if you know what you are doing.
|
||||||
allowedorigins: # allowed origins for websocket connections (same origin is always allowed)
|
allowedorigins: # allowed origins for websocket connections (same origin is always allowed)
|
||||||
# - ".+.example.com"
|
# - ".+.example.com"
|
||||||
# - "otherdomain.com"
|
# - "otherdomain.com"
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ type Configuration struct {
|
|||||||
}
|
}
|
||||||
ResponseHeaders map[string]string
|
ResponseHeaders map[string]string
|
||||||
Stream struct {
|
Stream struct {
|
||||||
AllowedOrigins []string
|
PingPeriodSeconds int `default:"45"`
|
||||||
|
AllowedOrigins []string
|
||||||
}
|
}
|
||||||
Cors struct {
|
Cors struct {
|
||||||
AllowOrigins []string
|
AllowOrigins []string
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func Create(db *database.GormDatabase, vInfo *model.VersionInfo, conf *config.Co
|
|||||||
g.Use(gin.Logger(), gin.Recovery(), error.Handler(), location.Default())
|
g.Use(gin.Logger(), gin.Recovery(), error.Handler(), location.Default())
|
||||||
g.NoRoute(error.NotFound())
|
g.NoRoute(error.NotFound())
|
||||||
|
|
||||||
streamHandler := stream.New(45*time.Second, 15*time.Second, conf.Server.Stream.AllowedOrigins)
|
streamHandler := stream.New(time.Duration(conf.Server.Stream.PingPeriodSeconds)*time.Second, 15*time.Second, conf.Server.Stream.AllowedOrigins)
|
||||||
authentication := auth.Auth{DB: db}
|
authentication := auth.Auth{DB: db}
|
||||||
messageHandler := api.MessageAPI{Notifier: streamHandler, DB: db}
|
messageHandler := api.MessageAPI{Notifier: streamHandler, DB: db}
|
||||||
healthHandler := api.HealthAPI{DB: db}
|
healthHandler := api.HealthAPI{DB: db}
|
||||||
|
|||||||
Reference in New Issue
Block a user