func (c *gcmClient) monitorXMPP(activeMonitor bool, clientIsConnected chan bool) {
	// Create XMPP client.
	log.WithField("sender id", c.senderID).Debug("creating gcm xmpp client")
	xmppc, err := connectXMPP(c.xmppClient, c.sandbox, c.senderID, c.apiKey,
		c.onCCSMessage, c.cerr, c.debug, c.omitRetry)
	if err != nil {
		// On initial connection, error exits the monitor.
		return
	}
	log.WithField("xmpp client ref", xmppc.ID()).Info("gcm xmpp client created")

	// If active monitoring is enabled, start pinging routine.
	if activeMonitor {
		c.spinUpActiveMonitor()
	}

	go c.loop(activeMonitor)

	// Wait just a tick to ensure Listen got called - without this there's probably an edge-case where if the
	// threading happens exactly wrong you can create a client, return it, and push out a send before you start
	// listening for its response and therefore you miss the response.  Given network latency that would probably
	// not ever happen but just to be paranoid... this also ensures that the tests (which assert that Listen got
	// called) reliably pass.
	time.Sleep(time.Millisecond)
	clientIsConnected <- true
}
// monitorXMPP creates a new GCM XMPP client (if not provided), replaces the active client,
// closes the old client and starts monitoring the new connection.
monitorXMPP creates a new GCM XMPP client (if not provided), replaces the active client,
closes the old client and starts monitoring the new connection.
// monitorXMPP creates a new GCM XMPP client ( if not provided ) replaces the active client // closes the old client and starts monitoring the new connection .
func (c *gcmClient) monitorXMPP(activeMonitor bool, clientIsConnected chan bool) {
	log.WithField("sender id", c.senderID).Debug("creating gcm xmpp client")
	xmppc, err := connectXMPP(c.xmppClient, c.sandbox, c.senderID, c.apiKey,
		c.onCCSMessage, c.cerr, c.debug, c.omitRetry)
	if err != nil {
		return
	}
	log.WithField("xmpp client ref", xmppc.ID()).Info("gcm xmpp client created")
	if activeMonitor {
		c.spinUpActiveMonitor()
	}
	go c.loop(activeMonitor)
	time.Sleep(time.Millisecond)
	clientIsConnected <- true
}
func ( c * gcmClient ) monitorXMPP ( activeMonitor bool , clientIsConnected chan bool ) { log . WithField ( " " , c . senderID ) . Debug ( " " ) xmppc , err := connectXMPP ( c . xmppClient , c . sandbox , c . senderID , c . apiKey , c . onCCSMessage , c . cerr , c . debug , c . omitRetry ) if err != nil { return } log . WithField ( " " , xmppc . ID ( ) ) . Info ( " " ) if activeMonitor { c . spinUpActiveMonitor ( ) } go c . loop ( activeMonitor ) time . Sleep ( time . Millisecond ) clientIsConnected <- true }
monitorXMPP creates a new GCM XMPP client (if not provided), replaces the active client,
closes the old client and starts monitoring the new connection.
monitorXMPP creates a new GCM XMPP client ( if not provided ) replaces the active client closes the old client and starts monitoring the new connection .
// Create XMPP client. // On initial connection, error exits the monitor. // If active monitoring is enabled, start pinging routine. // Wait just a tick to ensure Listen got called - without this there's probably an edge-case where if the // threading happens exactly wrong you can create a client, return it, and push out a send before you start // listening for its response and therefore you miss the response.  Given network latency that would probably // not ever happen but just to be paranoid... this also ensures that the tests (which assert that Listen got // called) reliably pass.