Openshift Online 3 with WebSockets. What is the correct “ws”?

守給你的承諾、 提交于 2019-12-25 01:45:07

问题


The problem is that after migrate from Openshift 2 to Openshift 3 I can't get WebSockets communication. Here is the same question but it doesn't work for me.

I've got:

Error during WebSocket handshake: Unexpected response code: 404

After refresh the same page:

Error during WebSocket handshake: Unexpected response code: 503

This is my code

var wsUri ="ws://" + document.location.host + "/scada1WebSockEndpoint"
var websocket = new WebSocket(wsUri);

And it works on my local Apache but does not work on Openshift platform. For me it looks like the websocket doesn't work at all or the wsUri incorrect. Any idea?


回答1:


Well, can't say that the problem solved, but I forced it work at least. I've just changed the type of server inside the Openshit Online 3. From Red Hat JBoss Web Server 3.0 Tomcat 8 to Red Hat JBoss Web Server 3.0 Tomcat 7. So it works now for Red Hat JBoss Web Server 3.0 Tomcat 7 on the cloud and Tomcat 8 on local PC. It means that the problem connects to Tomcat 8. But where could it be? Any idea would be appreciated.



来源:https://stackoverflow.com/questions/46571952/openshift-online-3-with-websockets-what-is-the-correct-ws

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!