一般来说一个client对server只有2个connect.一个收一个发.
如果开2个tab的情况, 则让2个tab各保持一个连接.
对于server端来说是这样的,根据cookie来判断是否multiframe,
如果发现是multiframe, 则改用传统的polling,就是每收到client的connect请求,就给一个response,里面带着advice有建议的interval.这样client就可以定期发送connect给server
如果不是multiframe,则server端收到connect后,会一直等到有event message才返回响应,
如果是, 则server会在收到connect后马上返回response,同时带上event message.
NO MULTIFRAME
/*[{"channel": "/meta/handshake", "version": "1.0", "supportedConnectionTypes": ["long-polling"], "clientId"
: "wFOjF72neFUoNhT", "successful": "true", "minimumVersion": "0.1", "authSuccessful": true, "advice": {"interval": 0, "multiple-clients": false}}]*/
/*[{"channel": "/meta/connect", "successful": "true", "clientId": "wFOjF72neFUoNhT", "error": "", "timestamp"
: "2007-12-04 08:38:17.641", "connectionId": "null", "advice": {"interval": 0, "multiple-clients": false}}]*/
MULTIFRAME
/*[{"channel": "/meta/handshake", "version": "1.0", "supportedConnectionTypes": ["long-polling"], "clientId"
: "IlfqaNmHSsyByxT", "successful": "true", "minimumVersion": "0.1", "authSuccessful": true, "advice": {"interval": 0, "multiple-clients": false}}]*/
/*[{"channel": "/meta/connect", "successful": "true", "clientId": "IlfqaNmHSsyByxT", "error": "", "timestamp"
: "2007-12-04 08:41:18.138", "connectionId": "null", "advice": {"interval": 3000, "multiple-clients": true}}]*/
分享到:
相关推荐
2.6稳定版,•CometD 是 Dojo Foundation 承接的一个项目,提供执行 Bayeux 协议的多个客户机和服务器实现。
atmosphere-bayeux-samples-0.5-sources.jar
atmosphere-bayeux-samples-0.5.2-sources.jar
atmosphere-bayeux-samples-0.3.1-sources.jar
atmosphere-bayeux-samples-0.3-sources.jar
atmosphere-bayeux-samples-0.4-sources.jar
atmosphere-bayeux-0.5-sources.jar
atmosphere-bayeux-0.7-sources.jar
atmosphere-bayeux-0.7.2-sources.jar
atmosphere-bayeux-0.7.1-sources.jar
atmosphere-bayeux-0.6.5-sources.jar
atmosphere-bayeux-0.6.4-sources.jar
atmosphere-bayeux-0.6-sources.jar
atmosphere-bayeux-0.6.3-sources.jar
atmosphere-bayeux-0.6.2-sources.jar
atmosphere-bayeux-0.6.1-sources.jar
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用