func writeJSON(conn *websocket.Conn, message interface{}) error { // Use the WriteJSON method to send a JSON message to the connection. return conn.WriteJSON(message) }
func writeBinary(conn *websocket.Conn, message []byte) error { // Use the WriteMessage method to send a binary message to the connection. return conn.WriteMessage(websocket.BinaryMessage, message) }This function takes a WebSocket connection and a binary message to send. It uses the `WriteMessage` method of the connection to send the message as binary data. Determining Package Library: From the import statement `import "github.com/gorilla/websocket"`, it is evident that the package library being used is `github.com/gorilla/websocket`.