2016-08-03 3 views

답변

1

https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-node-backend-how-to-use-server-sdk/#push-user 설명에 따르면

푸쉬 통지를 인증 된 사용자가 등록하는 사용자의 ID 태그 자동 등록에 추가된다. 이 태그를 사용하면 특정 사용자가 등록한 모든 장치에 푸시 알림을 보낼 수 있습니다.

인증 된 사용자 ID를 저장하기 위해 테이블과 연결되는 EasyTable 스크립트를 만들 수 있습니다.

table.insert(function (context) { 
    context.item.userId = context.user.id; 
    return context.execute(); 
}); 

이 이상 https://github.com/Azure/azure-content/blob/master/articles/app-service-mobile/app-service-mobile-node-backend-how-to-use-server-sdk.md#how-to-adjust-the-query-that-is-used-with-table-operations을 참조하십시오 : 당신은이를 구현하기 위해 다음과 같은 코드를 활용할 수 있습니다.

는이 PHP sample은 사용자 ID로 알림을 보내는 데 사용할 :

$hub = new NotificationHub("<connectionString>", "<hubName>"); 
$message = '{"data":{"message":"Hello from PHP!"}}'; 
$notification = new Notification("gcm", $message); 
$hub->sendNotification($notification, "_UserId:sid:<UserId>"); 
0

당신은 tags를 사용하는 것을 할 수 있습니다. 고유 한 태그를 각 사용자와 연결 한 다음 해당 태그에 알림을 보냅니다.

은 태그 작업 방법에 대한 단계별 자습서입니다.

그리고 How to use Notification Hubs from PHP은 PHP에서이를 수행하는 방법을 알려줍니다.

또한 this answerthe sample을 참조하십시오.

프로토 타입을 준비했으면 Diagnosis guidelines을 사용하여 문제를 해결하십시오.

+0

문제는 매장 태그하려고 메신저하지만 아무것도 푸른 포털에 발생하지 않습니다. 다음은'[NSSet setWithObjects : @ "user", nil];'객체를 보내는 것입니다. – TheZozoOwner

+0

아, 알림 허브 태그는 Azure 포털에 표시된 Azure Resource Manager 태그와 다릅니다. 그것은 정말 혼란스러워, [내 대답] (http://stackoverflow.com/a/38534891/182371) [Azure Notification Hub tags가 저장되지 않는 이유는 무엇입니까?] (http://stackoverflow.com/questions/36335644/) 왜 - 하늘빛 알림 허브 태그 - 저장 안됨/38534891 # 38534891) 명확하게 설명합니다. 또한 [Service Bus Explorer를 사용하여 Notification Hub 디버깅] (https://msdn.microsoft.com/en-us/library/azure/dn530751.aspx#sb_explorer)을 살펴보십시오. –

관련 문제