fix: harden websocket heartbeat under load
This commit is contained in:
@@ -322,6 +322,10 @@ type configType struct {
|
||||
// If true, do not attempt to negotiate websocket per message compression (RFC 7692.4).
|
||||
// It should be disabled (set to true) if you are using MSFT IIS as a reverse proxy.
|
||||
WSCompressionDisabled bool `json:"ws_compression_disabled"`
|
||||
// WebSocket heartbeat period and the maximum time to wait for a Pong, in seconds.
|
||||
// Zero values use the built-in defaults.
|
||||
WSPingPeriodSeconds int `json:"ws_ping_period_seconds"`
|
||||
WSPongWaitSeconds int `json:"ws_pong_wait_seconds"`
|
||||
// Address:port to listen for gRPC clients. If blank gRPC support will not be initialized.
|
||||
// Could be overridden from the command line with --grpc_listen.
|
||||
GrpcListen string `json:"grpc_listen"`
|
||||
@@ -716,6 +720,10 @@ func main() {
|
||||
|
||||
// Websocket compression.
|
||||
globals.wsCompression = !config.WSCompressionDisabled
|
||||
if err = configureWSHeartbeat(config.WSPingPeriodSeconds, config.WSPongWaitSeconds); err != nil {
|
||||
logs.Err.Fatal("Invalid WebSocket heartbeat configuration: ", err)
|
||||
}
|
||||
logs.Info.Printf("WebSocket heartbeat ping=%s pong_wait=%s", pingPeriod, pongWait)
|
||||
|
||||
if config.Media != nil {
|
||||
if config.Media.UseHandler == "" {
|
||||
|
||||
Reference in New Issue
Block a user