(msg []byte)
| 124 | } |
| 125 | |
| 126 | func (h *Hub) Write(msg []byte) (int, error) { |
| 127 | tmp := make([]byte, len(msg)) |
| 128 | copy(tmp, msg) |
| 129 | |
| 130 | select { |
| 131 | case h.broadcast <- tmp: |
| 132 | return len(tmp), nil |
| 133 | case <-h.quit: |
| 134 | return 0, fmt.Errorf("websocket hub is shutting down") |
| 135 | default: |
| 136 | return 0, fmt.Errorf("failed to broadcast over websocket") |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | func (h *Hub) Start() error { |
| 141 | h.mux.Lock() |
no outgoing calls
no test coverage detected