// package ui
// import (
// 	"github.com/gorilla/websocket"
// 	"time"
// 	"encoding/json"
// 	"github.com/docker/docker/pkg/jsonmessage"

// )
// type WSMessage struct {
// 	MsgType      string      `json:"msgType"`
// 	Timestamp time.Time   `json:"timestamp"`
// 	Payload   interface{} `json:"payload"`
// }
// type DonePayload struct {
// 	Success  bool `json:"success"`
// 	Failed   bool `json:"failed"`
// 	TimedOut bool `json:"timed_out"`
// }

// func makeWsEmit(conn *websocket.Conn) func([]byte) error {
// 	return func(b []byte) error {
// 		if conn == nil {
// 			return nil
// 		}
// 		// Send as a text message
// 		return conn.WriteMessage(websocket.TextMessage, b)
// 	}
// }
// func send(wsEmit func([]byte) error, msgType string, payload interface{}) {
// 	if wsEmit == nil {
// 		return
// 	}
// 	msg := WSMessage{
// 		MsgType:      msgType,
// 		Timestamp: time.Now().UTC(),
// 		Payload:   payload,
// 	}

// 	b, _ := json.Marshal(msg)
// 	_ = wsEmit(b)
// }