Vaadin 无法在 OpenShift 上建立 Websocket 连接 [英] Vaadin cannot establish Websocket connection on OpenShift

查看:54
本文介绍了Vaadin 无法在 OpenShift 上建立 Websocket 连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 OpenShift 服务器上使用 Vaadin 7.3 和 Tomcat8(从服务器上的源手动构建).我的另一个设置是 Tomcat7 7.0.54 也在 OpenShift 上.我的问题出现在这两种配置上.发生的情况如下:当我打开启用了 @Push 支持的 Vaadin 应用程序时,出现以下错误:

I'm using Vaadin 7.3 with Tomcat8 (built manually from sources on the server) on the OpenShift server. My other setup is Tomcat7 7.0.54 also on OpenShift. My problem appears on both those configurations. Here's what happens: while I'm opening my Vaadin application with the @Push support enabled, I get the following error:

WebSocket connection to 'ws://t8-drewconnect.rhcloud.com/web/PUSH/?v-uiId=0&v-csrfToken=4097664e-4d3b-4dd6-9474-0a6441986e9a&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 501 
​Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). vaadinPush.debug.js:13176
Websocket closed, wasClean: false vaadinPush.debug.js:13176
Mon Sep 22 07:39:46 GMT+200 2014 com.vaadin.client.VConsole
INFO: Push connection closed com.drewconnect.web.AppWidgetSet-0.js:4714
Websocket failed. Downgrading to Comet and resending vaadinPush.debug.js:13176
Mon Sep 22 07:39:46 GMT+200 2014 com.vaadin.client.VConsole
INFO: Push connection using primary method (websocket) failed. Trying with long-polling 

我花了很多时间在网上阅读,可以做些什么,阅读有关启用本机大气支持等的内容,并准备配置它,当我发现 Vaadin 使用捆绑到大气运行时中的大气时-2.1.2.vaadin3.jar,我不确定我是否可以摆脱.这篇大气文章 https://github.com/Atmosphere/atmosphere/wiki/Installing-AtmosphereServlet-with-or-without-native-support 建议使用大气运行时本机,但看起来 Vaadin 使用了一些自定义版本...

I have spent good amount of time reading on the web, what can be done about it, read about enabling native atmosphere support etc. and was about to configure it, when I discovered, that Vaadin uses Atmosphere bundled into atmosphere-runtime-2.1.2.vaadin3.jar, which I'm not sure if I can get rid of. This Atmosphere article https://github.com/Atmosphere/atmosphere/wiki/Installing-AtmosphereServlet-with-or-without-native-support suggests using atmosphere-runtime-native but it looks like Vaadin uses some customised version...

奇怪的是在本地主机上(在我的开发环境中),WebSockets 连接正在建立,没有任何问题......

Strangely on the localhost (in my dev environment) the WebSockets connection is being established without any problems...

我是解决问题的好方法还是完全不同的地方?;-) 你们知道这个问题的解决方案吗?我很感激这个答案,因为 websockets 和长轮询之间的协商需要很多时间 - 我必须等待大约 2 分钟才能让应用程序做出反应,有时它永远不会完成(在屏幕顶部有一个闪烁的进度条,永远不会达到 100%).我的客户,我已经向我展示了应用程序的演示,但在 10 个案例中有 9 个无法连接,所以我完全被卡住了 - 没有看到演示,他不会和我再进一步;(

Am I on a good way to fix the problem or am I somewhere completely else? ;-) Do you guys know the solution to this problem? I would appreciate the answer, because negotiation between websockets and long-polling takes a lot of time - I have to wait for about 2 minutes before the application reacts, and sometime it never finishes (at the top of the screen there's a blinking progress bar, which never gets to 100%). My customer, I've presented the demo of the application to, cannot connect in 9 out of 10 cases and so I'm completely stuck - without seeing the demo he won't go any further with me ;(

推荐答案

OpenShift 使用的默认前端代理尚不支持 WebSockets.我听说他们很快就会更新它.在此之前,您可以从已经支持 Web 套接字的端口 8000 使用他们的实验性替代代理.在您的情况下,它可以从地址到达:

The default front proxy used by OpenShift don't yet support WebSockets. I have heard they are about to update it soonish. Until that you can use their experimental alternative proxy from port 8000 that already supports web sockets. In your case it can be reached from address:

http://t8-drewconnect.rhcloud.com:8000/web/

另请注意,轮询 (UI.setPollingInterval(int)) 在大多数情况下通常已经足够了.

Also note that polling (UI.setPollingInterval(int)), is often good enough most purposes.

这篇关于Vaadin 无法在 OpenShift 上建立 Websocket 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆