使用Pusher API通知特定用户

Waj*_*man 1 javascript php pusher

我有一个使用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 );
Run Code Online (Sandbox Code Playgroud)

在移动网络应用程序上,我有该代码.

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) {});
        });
Run Code Online (Sandbox Code Playgroud)

Vid*_*dya 6

尝试在两端创建用户名(我假设用户是唯一的)部分频道名称.然后发布到该频道.