(path string, mt int, message []byte)
| 68 | } |
| 69 | |
| 70 | func SendToAll(path string, mt int, message []byte) { |
| 71 | clientsMu.RLock() |
| 72 | defer clientsMu.RUnlock() |
| 73 | |
| 74 | var wg sync.WaitGroup |
| 75 | for conn, client := range clients { |
| 76 | if client.Path == path { |
| 77 | wg.Add(1) |
| 78 | go func(c *websocket.Conn) { |
| 79 | defer wg.Done() |
| 80 | safeWriteMessage(c, mt, message) |
| 81 | }(conn) |
| 82 | } |
| 83 | } |
| 84 | wg.Wait() |
| 85 | } |
| 86 | |
| 87 | func GetClientsCount(path string) int { |
| 88 | clientsMu.RLock() |
no test coverage detected