开源项目 faye 咨询, 客户端如何接收服务器返回的数据

luffycn · December 24, 2014 · Last by luffycn replied at December 24, 2014 · 1980 hits
var client;

client = new Faye.Client('/faye');

client.subscribe('/topics', function(payload) {
  alert(payload.message)
});

上面代码 payload 并不是从服务器返回的数据,而是其它客户端提交到服务器的数据

当某个客户端提交到服务器后,经过服务器处理后,返回给客户端的信息,要怎么接收到了?

faye 的 pub/sub 机制,没有提供一个可以主动把 server 的数据 push 到 client 的功能啊?

服务器也可以给客户端发推送的。服务器作为一个 client 发出去。但你需要知道客户端订阅的频道

@jimrokliu thanks for your tips. checked the doc again.. got it... thanks very very much

You need to Sign in before reply, if you don't have an account, please Sign up first.