如何使用 Atmosphere (Meteor) 将消息从一个客户端广播到另一个客户端?我目前有一个基于 Meteor 教程的实现
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
Meteor.build(req).addListener(new AtmosphereResourceEventListenerAdapter());
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException {
String body = req.getReader().readLine().trim();
//some DAO lookups - here I would like to say I want to broadcast only to concrete client
BroadcasterFactory.getDefault().lookup(DefaultBroadcaster.class, "/*").broadcast(UserDAO.getInstance().getUser(name));
}
以下是其 wiki 上的 Atmosphere 常见问题解答:https://github.com/Atmosphere/atmosphere/wiki/Creating-private-channel-of-communication- Between-Browsers https://github.com/Atmosphere/atmosphere/wiki/Creating-private-channel-of-communication-between-Browsers
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)