首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >大气回退不起作用?

大气回退不起作用?
EN

Stack Overflow用户
提问于 2018-05-24 07:02:00
回答 1查看 274关注 0票数 0

我对大气很陌生。到目前为止,我已经设法为我现有的Tomcat 8+ Spring + Struts2 web应用程序添加了气氛。我使用了当前版本(氛围-运行时2.4.24,气氛-弹簧2.4.20和atmosphere.js 2.3.5)。

对于某种简单的状态页,我已经设法使SSE传输正常工作。使用谷歌Chrome或Mozilla,这是非常好的工作。我喜欢它!在实现了这一功能之后,我想检查无法实现SSE (Internet和Edge)的浏览器的回退。在客户端日志中,我可以看到氛围可以很好地检测到SSE特性的缺失,并使用回退:

代码语言:javascript
复制
    Server Side Events(SSE) is not supported, using request.fallbackTransport (long-polling)
atmosphere.js (3272,21)

 Thu May 24 2018 08:54:28 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: ajaxRequest.onreadystatechange, new state: 2
atmosphere.js (3272,21)

 Thu May 24 2018 08:54:28 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: ajaxRequest.onreadystatechange, new state: 3
atmosphere.js (3272,21)

 Thu May 24 2018 08:54:28 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: ajaxRequest.onreadystatechange, new state: 4
atmosphere.js (3272,21)

 Thu May 24 2018 08:54:29 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: ajaxRequest.onreadystatechange, new state: 2
atmosphere.js (3272,21)

 Thu May 24 2018 08:54:29 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: Firing onOpen
atmosphere.js (3272,21)

 Atmosphere connected using long-polling
utils.js (879,3)

 Thu May 24 2018 08:54:29 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: Firing onOpen
atmosphere.js (3272,21)

 Thu May 24 2018 08:54:29 GMT+0200 (Mitteleuropäische Sommerzeit) Atmosphere: ajaxRequest.onreadystatechange, new state: 3
atmosphere.js (3272,21)

但是,即使我可以调试服务器端并看到消息正在写入AtmosphereResource,也没有数据到达客户端。我就是这样在客户端初始化气氛连接的:

代码语言:javascript
复制
request = { 
        url: '<s:url value="/public/sse/ci" />',
        contentType: "application/json",
        method: 'POST',
        logLevel: 'debug',
        transport: 'sse',
        reconnectInterval: 5000,
        fallbackTransport: 'long-polling'
    };

有人能给我一个正确方向的提示吗?

致以亲切的问候,

塞巴斯蒂安

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-29 13:45:26

好吧。

我终于让它起作用了。与this stackoverflow question一样,我在服务器配置中添加了TrackMessageSizeInterceptor,但在客户端配置中没有添加。也许其他人来这里读答案。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50502972

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档