fonchain-fiee/pkg/common/ws/ginWSUpgrade.go
2025-06-12 17:07:49 +08:00

22 lines
514 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package utils -----------------------------
// @file : hertzWSUpgrade.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2022/6/28 14:19
// -------------------------------------------
package ws
import (
"github.com/gorilla/websocket"
"net/http"
)
var UpGrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {
// 检查请求的来源是否允许websocket连接可根据需求自行实现
return true
},
}