【发布时间】:2013-10-22 09:23:07
【问题描述】:
我有一个使用 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) {});
});
【问题讨论】:
标签: javascript php pusher