【发布时间】:2015-04-08 04:59:42
【问题描述】:
我编写了一个网站,作为我的 android 应用程序的 websocket 客户端,它在我的 WiFi 网络中充当 websocket 服务器。最初我只是用 javascript/jquery 编写的,它已经可以正常工作了,但是因为我对 vaadin 很着迷,所以我用 vaadin 完全重写了它,它已经可以在本地 tomcat 7 或 8 上工作,但不能在远程 tomcat 7 上工作或 8. android 服务器的 onOpen 方法永远不会被调用。 jquery 版本的服务器与 vaadin 版本的服务器相同,但是当我尝试启动我的页面时,我收到此错误并且页面没有连接到我的手机,虽然我可以 ping 我的手机:
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-version 和相同的 javaversion,即使我禁用了防火墙。没有抛出异常,并且无法找出它为什么不起作用。
任何想法我做错了什么?
【问题讨论】: