0

In Azure Mobile Service javascript backend ,trying to send a notification by calling notification hub through custom api. Its giving me a notification , but everytime giving a time out error too. I observed my logs and its showing "An error occurred creating push for user scripts: azure.notificationHubService could not be created" .

Instead of using azure.createNotificationHubService method , is there any way to import already created notification hub service ?How to get rid of the time out error. I am pasting function below.

function sendnotification() {

          var azure = require('azure');  
          var notificationHubService = azure.createNotificationHubService('disapphub','Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=my_key_here=;');

          var payload = {
  data: {
    "type":"newthread",

  }


};

var mytags ='admin';
notificationHubService.gcm.send(mytags, payload, function(error){
  if(!error){
    //notification sent
  }
});

    }
Adrian Hall
  • 7,990
  • 1
  • 18
  • 26
SHINERAJ ARATHIL
  • 466
  • 5
  • 13
  • Hi, do you mind sharing the full error? I wonder if it's similar to http://stackoverflow.com/questions/36277946/mobile-service-configuration-ms-notificationhubconnectionstring-contains-invali? – Mimi Xu Jun 29 '16 at 18:17
  • @MimiXu ,Error message is same as in other question.My connection string is, var notificationHubService = azure.createNotificationHubService('servicehubname','Endpoint=sb://servicenamehub.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=mykey=;'); I do not have 'entity path; part as shown in other question. When I tried adding entity path its giving me a Error: Invalid connection string setting key "entitypath" – SHINERAJ ARATHIL Jun 30 '16 at 05:07

0 Answers0