admin管理员组文章数量:1399225
i have one mobile web app using jquery mobile and phonegap and other is php website .i want that send notification just to particular user who's online and on mobile app as well, recieve notification which user online on php website end as well as mobile web app so my question is that how to set channel for particular user because now notification sent to all users which is useless of messages and connection.
Currently my code sending notifications to all can any one idea about this problem where changes will require on my code.
on event trigger i have that code php site.
$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 );
on mobile web app i have that Code.
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) {});
});
i have one mobile web app using jquery mobile and phonegap and other is php website .i want that send notification just to particular user who's online and on mobile app as well, recieve notification which user online on php website end as well as mobile web app so my question is that how to set channel for particular user because now notification sent to all users which is useless of messages and connection.
Currently my code sending notifications to all can any one idea about this problem where changes will require on my code.
on event trigger i have that code php site.
$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 );
on mobile web app i have that Code.
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) {});
});
Share
Improve this question
asked Oct 14, 2013 at 18:17
WajihurrehmanWajihurrehman
5673 gold badges15 silver badges29 bronze badges
1 Answer
Reset to default 7Try making the username (which I assume is unique to the user) part of the channel name on both ends. Then publish to that channel.
本文标签: javascriptUsing Pusher API notify Particular UserStack Overflow
版权声明:本文标题:javascript - Using Pusher API notify Particular User - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744207894a2595278.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论