Registration endpoint
Updated: June 3, 2015
Microsoft Azure Mobile Services integrates with Azure Notification Hubs to enable clients to register for push notifications right from the Mobile Services client library. You can set the permissions on the endpoint used for push registrations like any other Mobile Services resource. Use the Permission dropdown to set registration permissions in your JavaScript backend mobile service. Permissions in a .NET backend mobile service are set in the WebApiConfig.cs project file.
You can invoke your own custom business logic when a registration is created or changed. This business logic might include adding, deleting or validating tags supplied by the client. In a JavaScript backend mobile service, click Edit Script to edit the register callback function. This function is passed the registration sent by the client, as well as the registrationContext of the service. The service and user objects are both fields of the registrationContext. The supplied done function is called to end the callback. When you call done with an error parameter or call throw to raise an exception, the server returns an internal server error (500) and registration fails. This enables you to validate and reject user-supplied tags.
For a .NET backend mobile service, this same registration business logic is defined by implementing the INotificationHandler interface. For an example of how to use the registration endpoint, see Send push notifications to authenticated users.