【发布时间】:2014-04-19 12:28:41
【问题描述】:
我使用 PHP 和 Pusher API 编写聊天程序。 现在,我正在尝试向单个用户触发事件,但我不知道该怎么做。 每个用户都由一个会话(用户名)标识。 这就是我触发消息的方式:
$pusher->trigger(
'presence-nettuts', //the channel
'new_message', //the event
array('message' => $message) //the data to send
);
//echo the success array for the ajax call
echo json_encode(array(
'message' => $message,
'success' => true
));
exit();
我只想将事件定向到在线用户,该用户使用会话由他的用户名标识。
你能指导我怎么做吗?
谢谢。
【问题讨论】: