HTML5 Server sent events and multiple clients (without using Comet)

被刻印的时光 ゝ 提交于 2019-12-01 10:41:03

Unless you can target a specific set of recent browsers you will always have to support some sort of fallback. Atmosphere looks like a good solution for that.

As to sending the right events to the right clients: Keep track of the clients and their preferences in either a Session object (check of Atmosphere is configured to support sessions) or your own Map. It looks like you can create multiple session broadcasters in Atmosphere as outlined here: http://blog.javaforge.net/post/32659151672/atmosphere-per-session-broadcaster

Disclaimer: I've never used this myself.

What you could do is to send parameters via GET when you register an event with EventSource. The only problem lies at point #4, for which you should close the connection and re-register the event.

I tried that myself and it works pretty well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!