1
0
mirror of https://github.com/nxshock/gron.git synced 2024-11-27 03:41:00 +05:00
gron/wconn.go

24 lines
336 B
Go

package main
import (
"sync"
"github.com/gorilla/websocket"
)
type WsConnection struct {
w *websocket.Conn
mu sync.Mutex
}
func NewWsConnection(w *websocket.Conn) *WsConnection {
return &WsConnection{w: w}
}
func (w *WsConnection) Send(message any) error {
w.mu.Lock()
defer w.mu.Unlock()
return w.w.WriteJSON(message)
}