我编写了一个网站,作为我的Android应用程序的websocket客户端,充当我的WiFi网络中的websocket服务器。最初我用javascript / jquery编写它并且它已经没有任何问题,但因为我对vaadin着迷,我完全用vaadin重写它并且它已经在本地tomcat 7或8上工作,但不在远程tomcat上7或8.永远不会调用android服务器的onOpen方法。 jquery版本的服务器与vaadin版本的服务器相同,但是当我尝试启动我的页面时,我收到此错误并且页面未连接到我的手机,虽然我可以ping我的手机:< / p>
vaadinPush.debug.js:11276: WebSocket connection to 'ws://serialcall.rdroid.info/PUSH/?v-uiId=3&v-csrfToken=18797926-2579-4599-a0af-29729f9deb88&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: 500
这是非工作远程服务器上的vaadin日志信息
371ms Queuing push message: {"csrfToken":"0b112c17-8c20-4307-8d2b-871589d720a6", "rpc":[["505","com.vaadin.shared.ui.ui.UIServerRpc","resize",["923","1280","1280","923"]],["506","org.vaadin.jouni.animator.client.AnimatorServerRpc","preserveStyles",[{"useKeyframeAnimation":false, "animationTarget":"546", "duration":"2000", "delay":"0", "css":{"properties":{"opacity":"0.2"}}, "easing":"DEFAULT", "id":"25", "iterationCount":"1", "preserveStyles":true}]]], "syncId":1}
720ms Push connection closed
721ms Push connection using primary method (websocket) failed. Trying with long-polling
1131ms Push connection established using long-polling
1132ms Sending push message: {"csrfToken":"0b112c17-8c20-4307-8d2b-871589d720a6", "rpc":[["505","com.vaadin.shared.ui.ui.UIServerRpc","resize",["923","1280","1280","923"]],["506","org.vaadin.jouni.animator.client.AnimatorServerRpc","preserveStyles",[{"useKeyframeAnimation":false, "animationTarget":"546", "duration":"2000", "delay":"0", "css":{"properties":{"opacity":"0.2"}}, "easing":"DEFAULT", "id":"25", "iterationCount":"1", "preserveStyles":true}]]], "syncId":1}
1154ms No onClose was received before reconnect. Forcing state to closed.
这是vaadin日志消息在工作本地服务器上的显示方式:
1008ms Making UIDL Request with params: {"csrfToken":"6be927e0-1e38-407d-b8fe-744d83a23e43", "rpc":[["1614","com.vaadin.shared.ui.ui.UIServerRpc","resize",["923","1280","1280","923"]],["1615","org.vaadin.jouni.animator.client.AnimatorServerRpc","preserveStyles",[{"useKeyframeAnimation":false, "animationTarget":"1655", "duration":"2000", "delay":"0", "css":{"properties":{"opacity":"0.2"}}, "easing":"DEFAULT", "id":"20", "iterationCount":"1", "preserveStyles":true}]]], "syncId":1}
1009ms Queuing push message: {"csrfToken":"6be927e0-1e38-407d-b8fe-744d83a23e43", "rpc":[["1614","com.vaadin.shared.ui.ui.UIServerRpc","resize",["923","1280","1280","923"]],["1615","org.vaadin.jouni.animator.client.AnimatorServerRpc","preserveStyles",[{"useKeyframeAnimation":false, "animationTarget":"1655", "duration":"2000", "delay":"0", "css":{"properties":{"opacity":"0.2"}}, "easing":"DEFAULT", "id":"20", "iterationCount":"1", "preserveStyles":true}]]], "syncId":1}
1303ms Push connection established using websocket
我使用tootallnate作为websocket客户端,我在服务器和本地计算机上具有相同的tomcat版本和相同的javaversion,即使我禁用了防火墙。没有异常被抛出,也无法找出它为什么不起作用。
任何想法我做错了什么?
答案 0 :(得分:0)
看起来您已将应用程序部署到没有公共IP的Jelastic实例中,这意味着所有请求都由nginx代理。如上所述here,您必须获取公共IP才能让您的应用程序使用Jelastic中的WebSockets。