def _cm_send_json(registration_ids, data, cloud_type='GCM', **kwargs):
 values = ({'registration_ids': registration_ids} if registration_ids else {})
 if (data is not None):
  values['data'] = data
 for (k, v) in kwargs.items():
  if v:
   values[k] = v
 data = json.dumps(values, separators=(',', ':'), sort_keys=True).encode('utf-8')
 if (cloud_type == 'GCM'):
  response = json.loads(_gcm_send(data, 'application/json'))
 elif (cloud_type == 'FCM'):
  response = json.loads(_fcm_send(data, 'application/json'))
 else:
  raise ImproperlyConfigured(('cloud_type must be GCM or FCM not %s' % str(cloud_type)))
 return _handler_cm_message_json(registration_ids, response, cloud_type)

def _cm_send_json ( registration_ids , data , cloud_type = 'GCM' , ** kwargs ) : values = ( { 'registration_ids' : registration_ids } if registration_ids else { } ) if ( data is not None ) : values [ 'data' ] = data for ( k , v ) in kwargs . items ( ) : if v : values [ k ] = v data = json . dumps ( values , separators = ( ',' , ':' ) , sort_keys = True ) . encode ( 'utf-8' ) if ( cloud_type == 'GCM' ) : response = json . loads ( _gcm_send ( data , 'application/json' ) ) elif ( cloud_type == 'FCM' ) : response = json . loads ( _fcm_send ( data , 'application/json' ) ) else : raise ImproperlyConfigured ( ( 'cloud_type must be GCM or FCM not %s' % str ( cloud_type ) ) ) return _handler_cm_message_json ( registration_ids , response , cloud_type )
sends a gcm notification to one or more registration_ids .