def test_ios_provider(self): # Creazione del messaggio da "pushare" extra_data = {"message_id": 141, "channel_name": "Test", "channel_image_url": "http://www.pushetta.com/uploads/channel_media/05e704fc35e544dfa50bacf89dda0eee.jpeg", "ott": "111"} pmsg = PushMessage(alert_msg="Long text with ", push_type="plain_push", data_dic=extra_data) provider = PushProviderFactory.create('ios', logger) provider.pushMessage(pmsg, ['c0f5eb4db72a04d24d474e7cae5f1e7828f6f9bcaa8f083476e4840cc552a4c3'], "a channel")
def push_messages(pmsg, channel_name, platform): """ :param pmsg: Message to push :param channel_name: Channel to push :param platform: Target platform """ sub_tokens = SubscriberManager().get_subscribers(channel_name, platform) logger.info("Pushing {0} tokens to channel {1} for platform {2}".format(len(sub_tokens), channel_name, platform)) # PUSH EFFETTIVO pusher = PushProviderFactory.create(platform, logger) pusher.pushMessage(pmsg, sub_tokens, channel_name)
def push_messages(pmsg, channel_name, platform): """ :param pmsg: Message to push :param channel_name: Channel to push :param platform: Target platform """ sub_tokens = SubscriberManager().get_subscribers(channel_name, platform) logger.info("Pushing {0} tokens to channel {1} for platform {2}".format( len(sub_tokens), channel_name, platform)) # PUSH EFFETTIVO pusher = PushProviderFactory.create(platform, logger) pusher.pushMessage(pmsg, sub_tokens, channel_name)
def test_mqtt_provider(self): extra_data = { "message_id": 141, "channel_name": "flower", "channel_image_url": "http://www.pushetta.com/uploads/channel_media/05e704fc35e544dfa50bacf89dda0eee.jpeg", "ott": "111" } pmsg = PushMessage(alert_msg="Message over MQTT test", push_type="plain_push", data_dic=extra_data) provider = PushProviderFactory.create('iot_device', logger) # Nota...il push su MQTT non richiede token perchè la subscription al canale è uno stato # persistente gestita dal protcollo (chi è connesso e ha fatto subscribe al topic riceve il messaggio) provider.pushMessage(pmsg, ['#'], "flower")
def test_ios_provider(self): # Creazione del messaggio da "pushare" extra_data = { "message_id": 141, "channel_name": "Test", "channel_image_url": "http://www.pushetta.com/uploads/channel_media/05e704fc35e544dfa50bacf89dda0eee.jpeg", "ott": "111" } pmsg = PushMessage(alert_msg="Long text with ", push_type="plain_push", data_dic=extra_data) provider = PushProviderFactory.create('ios', logger) provider.pushMessage(pmsg, [ 'c0f5eb4db72a04d24d474e7cae5f1e7828f6f9bcaa8f083476e4840cc552a4c3' ], "a channel")