add broadcast to all client and modify lingpong handler
This commit is contained in:
@@ -17,6 +17,12 @@ type ClientHandler struct {
|
||||
Clients models.Clients
|
||||
}
|
||||
|
||||
func SendBroadcast(msg []byte) {
|
||||
for _, c := range models.Broadcast {
|
||||
c.SendResponse(msg)
|
||||
}
|
||||
}
|
||||
|
||||
// initaiates new conections with client map
|
||||
func NewConnectionHandler() *ClientHandler {
|
||||
return &ClientHandler{
|
||||
@@ -41,7 +47,6 @@ func (cH *ClientHandler) ConnectNewClient(id string, c *gin.Context) (client *mo
|
||||
cH.Lock()
|
||||
cH.Clients[id] = client
|
||||
cH.Unlock()
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user