feat: WebSocket upgrader, hub, send, broadcast, handler con tests (issue 0011 fase 3-4)

This commit is contained in:
2026-04-18 17:29:37 +02:00
parent 637bc8fd34
commit e35ec39c10
11 changed files with 784 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
package infra
import "fmt"
// WSBroadcast envia bytes al canal Broadcast del hub para entregar el mensaje
// a todos los clientes conectados. La entrega real la hace el loop Run() del hub.
// Bloqueante hasta que el canal Broadcast tenga espacio (capacidad 256 por defecto).
func WSBroadcast(hub *WSHub, msg []byte) error {
if hub == nil {
return fmt.Errorf("ws broadcast: hub is nil")
}
hub.Broadcast <- msg
return nil
}