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
}
});
}