我有一个使用 jquery mobile 和 phonegap 的移动网络应用程序,另一个是 php 网站。我希望只向在线和移动应用程序上的特定用户发送通知,接收在 php 网站端以及移动网络应用程序上在线的用户的通知所以我的问题是如何为特定用户设置频道,因为现在通知发送给所有用户,这对消息和连接毫无用处。
目前,我的代码向所有人发送通知对于我的代码需要更改的这个问题有任何想法。
在事件触发器上,我有那个代码 php 站点。
$message = "User Response Has been Sent For Taxi On way";
$pusher = new Pusher( APP_KEY, APP_SECRET, APP_ID );
$data = array('message' => $message);
$pusher->trigger( 'dispatcher_channel', 'dispatcher_Response', $data );
在移动网络应用程序上,我有该代码。
Pusher.log = function(message) {
if (window.console && window.console.log) {
window.console.log(message);
}
};
var pusher = new Pusher('APP_KEY');
var channel = pusher.subscribe('dispatcher_channel');
channel.bind('dispatcher_Response', function(data) {
alert(data.message);
channel.bind('dispatcher_Response', function(data) {});
});