Search code examples
iosazureapple-push-notificationsazure-mobile-servicesazure-notificationhub

How to view registered devices for Azure Notifications Hub on a Mac?


I am working on an iOS app and signed up for Azure notifications hub to use their push notifications service.

However I immediately ran into a problem as I set up everything but push is not going through. I looked up a solution to debug this situation and the documentation seems to lead me to downloading "Service Bus Explorer" https://code.msdn.microsoft.com/windowsapps/Service-Bus-Explorer-f2abca5a However this requires I have visual studio running, which requires that I have Windows. It's ridiculous if this is the case, since obviously you need to be on a Mac to develop an iOS app.

Am I missing something or is this for real? Anyone have advice?


Solution

  • Your best bet may be to install Node.js locally on your Mac and use the azure NPM to query the Notification Hub. Create a script:

    var azure = require('azure-sb');
    var notificationHubService = azure.createNotificationHubService('hubname','connectionstring');
    notificationHubService.listRegistrations(function(err, registrations) {
      console.log(JSON.stringify(registrations));
    });
    

    and then you can run

    node scriptname.js
    

    You may want to iterate through the registrations, pretty-print the parts that are useful to you, and so on.

    Unfortunately, the documentation is scarce or well-hidden, so it is good to keep the NPM source bookmarked to see what the functions are.

    Having Windows in a virtual machine to query the Notification Hub with Visual Studio is also an alternative. I don't find myself using it to work with Notification Hubs, though, just for optimizing queries in SSMS.