mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-08-07 14:25:17 +03:00
18 lines
284 B
Go
18 lines
284 B
Go
package common
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
func CloseWS(ws *websocket.Conn) {
|
|
if ws == nil {
|
|
return
|
|
}
|
|
ws.WriteControl(websocket.CloseMessage,
|
|
websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""),
|
|
time.Now().Add(time.Second))
|
|
ws.Close()
|
|
}
|