func (mel *Melodious) IterateOverConnections(username string, f func(connInfo *ConnInfo)) {
	m, loaded := mel.UserConns.Load(username)
	if !loaded {
	} else if m := m.(*sync.Map); m != nil {
		m.Range(func(key interface{}, value interface{}) bool {
			if connInfo := key.(*ConnInfo); connInfo != nil {
				go f(connInfo)
			}
			return true
		})
	}
}
IterateOverConnections - iterates over all connections of a given username
package main
import (
	"net"
	"net/http"
	"sync"
	"github.com/apex/log"
)
type Melodious struct {
	Config    *Config
	Database  *Database
	UserConns *sync.Map
}
func NewMelodious(cfg *Config) *Melodious {
	return &Melodious{
		Config:    cfg,
		Database:  nil,
		UserConns: &sync.Map{},
	}
}
func (mel *Melodious) ConnectToDB() {
	var err error
	mel.Database, err = NewDatabase(mel, mel.Config.DBAddr)
	if err != nil {
		panic(err)
	}
}
func (mel *Melodious) webServerRunner() {
	h := NewHTTPHandler(mel)
	server := &http.Server{Handler: h}
	l, err := net.Listen("tcp4", mel.Config.HTTPAddr)
	if err != nil {
		log.WithField("err", err).Error("cannot listen")
	}
	err = server.Serve(l)
	if err != nil {
		log.WithField("err", err).Error("cannot serve")
	}
}
func (mel *Melodious) RunWebServer() <-chan bool {
	done := make(chan bool)
	go func() {
		log.WithField("addr", mel.Config.HTTPAddr).Info("serving")
		mel.webServerRunner()
		done <- true
	}()
	return done
}
func (mel *Melodious) PutConnection(username string, connInfo *ConnInfo) {
	m := &sync.Map{}
	m.Store(connInfo, true)
	mm, loaded := mel.UserConns.LoadOrStore(username, m)
	if !loaded {
	} else if m := mm.(*sync.Map); m != nil {
		m.Store(connInfo, true)
		mel.UserConns.Store(username, m)
	} else {
		mel.UserConns.Store(username, m)
	}
}
func (mel *Melodious) RemoveConnection(username string, connInfo *ConnInfo) {
	m, loaded := mel.UserConns.Load(username)
	if !loaded {
	} else if m := m.(*sync.Map); m != nil {
		m.Delete(connInfo)
	}
}