package api import ( "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/markets" ) var Poloniex *markets.Poloniex func OpenMarketsConnection() error { for { err := Poloniex.StartTicker() if err != nil { return err } log.Warn("connection to poloniex stream ended, restarting it...") } } func init() { Poloniex = markets.NewPoloniex() // We open markets connections in the background as it can take time. go func() { err := OpenMarketsConnection() if err != nil { ErrorChan <- err } }() }