grain/relay/handlers/response/ok.go

13 lines
312 B
Go
Raw Normal View History

2024-07-25 14:19:42 +00:00
package response
2024-07-24 21:00:59 +00:00
import (
"encoding/json"
"golang.org/x/net/websocket"
)
2024-07-25 14:19:42 +00:00
func SendOK(ws *websocket.Conn, eventID string, status bool, message string) {
2024-07-24 21:00:59 +00:00
response := []interface{}{"OK", eventID, status, message}
responseBytes, _ := json.Marshal(response)
websocket.Message.Send(ws, string(responseBytes))
}