diff --git a/pkg/config/config.go b/pkg/config/config.go index ce76944..6493c71 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -13,7 +13,7 @@ import ( // Version of the config format - when new fields are added, it will attempt // to write the settings.toml to disk so new defaults populate. -var currentVersion = 8 +var currentVersion = 9 // Config for your BareRTC app. type Config struct { @@ -36,9 +36,10 @@ type Config struct { UseXForwardedFor bool - WebSocketReadLimit int64 - MaxImageWidth int - PreviewImageWidth int + WebSocketReadLimit int64 + WebSocketSendTimeout int + MaxImageWidth int + PreviewImageWidth int TURN TurnConfig @@ -112,9 +113,10 @@ func DefaultConfig() Config { CORSHosts: []string{ "https://www.example.com", }, - WebSocketReadLimit: 1024 * 1024 * 40, // 40 MB. - MaxImageWidth: 1280, - PreviewImageWidth: 360, + WebSocketReadLimit: 1024 * 1024 * 40, // 40 MB. + WebSocketSendTimeout: 10, // seconds + MaxImageWidth: 1280, + PreviewImageWidth: 360, PublicChannels: []Channel{ { ID: "lobby", diff --git a/pkg/websocket.go b/pkg/websocket.go index 5c86acc..05bf50f 100644 --- a/pkg/websocket.go +++ b/pkg/websocket.go @@ -218,7 +218,7 @@ func (s *Server) WebSocket() http.HandlerFunc { for { select { case msg := <-sub.messages: - err = writeTimeout(ctx, time.Second*15, c, msg) + err = writeTimeout(ctx, time.Second*time.Duration(config.Current.WebSocketSendTimeout), c, msg) if err != nil { return } diff --git a/src/App.vue b/src/App.vue index 0eeb27e..49f59b0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,7 +57,7 @@ export default { windowFocusedAt: new Date(), // Disconnect spamming: don't retry too many times. - disconnectLimit: 3, + disconnectLimit: 2, disconnectCount: 0, // Temp: spam counting for OF links