grain/server/handlers/response/closed.go

14 lines
290 B
Go

package response
import (
"encoding/json"
"golang.org/x/net/websocket"
)
func SendClosed(ws *websocket.Conn, subID string, message string) {
closeMsg := []interface{}{"CLOSED", subID, message}
closeBytes, _ := json.Marshal(closeMsg)
websocket.Message.Send(ws, string(closeBytes))
}