a method to publish wifi fingerprint data to a mosquitto server
            
        :param user_id: string with id of user
        :param wifi_fingerprint: list of dictionaries with wifi fields mac and rssi 
        :param action: string with type of action to perform with data (track or learn)
        :param location_id: [optional] string with classifier to add to learning data
        :param port: [optional] integer with port to connect to
        :return: True

def publish(self, user_id, wifi_fingerprint, action='track', location_id='', port=1883):

        '''
            a method to publish wifi fingerprint data to a mosquitto server
            
        :param user_id: string with id of user
        :param wifi_fingerprint: list of dictionaries with wifi fields mac and rssi 
        :param action: string with type of action to perform with data (track or learn)
        :param location_id: [optional] string with classifier to add to learning data
        :param port: [optional] integer with port to connect to
        :return: True
        '''
        
        title = '%s.publish' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'user_id': user_id,
            'wifi_fingerprint': wifi_fingerprint,
            'action': action,
            'location_id': location_id,
            'port': port
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
            
    # compose message
        fingerprint_string = ''
        for signal in wifi_fingerprint:
            fingerprint_string += signal['mac'].replace(':','')
            rssi_string = str(signal['rssi']).replace('-','')
            if len(rssi_string) > 2:
                fingerprint_string += ' '
            fingerprint_string += rssi_string

    # compose channel
        topic_string = '%s/track/%s' % (self.group_name, user_id)
        if action == 'learn':
            topic_string = '%s/learn/%s/%s' % (self.group_name, user_id, location_id)

    # send a single message to server
        import paho.mqtt.publish as mqtt_publish
        mqtt_publish.single(
            topic=topic_string,
            payload=fingerprint_string,
            auth={ 'username': self.group_name, 'password': self.password },
            hostname=self.server_url,
            port=port
        )

        return True