🚀 dashboard v0.14.7 with agent v0.14.4

This commit is contained in:
naiba committed 2022-11-01 21:46:02 +08:00
1 parent e36fae2da1
commit ab5b6eddf0
8 files changed
+47 -12

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
package websocketx
import (
"sync"
"github.com/gorilla/websocket"
"github.com/samber/lo"
)
type Conn struct {
*websocket.Conn
writeLock sync.Mutex
}
func (conn *Conn) WriteMessage(msgType int, data []byte) error {
conn.writeLock.Lock()
defer conn.writeLock.Unlock()
var err error
lo.TryCatchWithErrorValue(func() error {
return conn.Conn.WriteMessage(msgType, data)
}, func(res any) {
err = res.(error)
})
return err
}