Make ws ping interval configurable
This commit is contained in:
parent
909eeff406
commit
de226ce0cf
|
|
@ -35,6 +35,7 @@ server:
|
|||
# - "Authorization"
|
||||
# - "content-type"
|
||||
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)
|
||||
# - ".+.example.com"
|
||||
# - "otherdomain.com"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ type Configuration struct {
|
|||
}
|
||||
ResponseHeaders map[string]string
|
||||
Stream struct {
|
||||
PingPeriodSeconds int `default:"45"`
|
||||
AllowedOrigins []string
|
||||
}
|
||||
Cors struct {
|
||||
|
|
|
|||
|
|
@ -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.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}
|
||||
messageHandler := api.MessageAPI{Notifier: streamHandler, DB: db}
|
||||
healthHandler := api.HealthAPI{DB: db}
|
||||
|
|
|
|||
Loading…
Reference in New Issue