🎨 以 Docker 容器运行时不再进行 WebSocket 传输压缩 Fix https://github.com/siyuan-note/siyuan/issues/5892

This commit is contained in:
Liang Ding 2022-09-16 10:47:25 +08:00
parent 0db807cea8
commit fbe44a0aa0
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 19 additions and 27 deletions

View file

@ -26,12 +26,12 @@ import (
"time"
"github.com/88250/gulu"
"github.com/88250/melody"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
"github.com/mssola/user_agent"
"github.com/olahol/melody"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/api"
"github.com/siyuan-note/siyuan/kernel/cmd"
@ -232,10 +232,6 @@ func serveDebug(ginServer *gin.Engine) {
func serveWebSocket(ginServer *gin.Engine) {
util.WebSocketServer.Config.MaxMessageSize = 1024 * 1024 * 8
if util.ContainerDocker == util.Container { // Docker 容器运行时启用 WebSocket 传输压缩
util.WebSocketServer.Config.EnableCompression = true
util.WebSocketServer.Config.CompressionLevel = 4
}
ginServer.GET("/ws", func(c *gin.Context) {
if err := util.WebSocketServer.HandleRequest(c.Writer, c.Request); nil != err {