Openshift Tornado WebSocket(Demo) not responding

偶尔善良 提交于 2019-12-11 13:37:41

问题


I am trying to host websocket app in python on openshift I found this repo: https://github.com/ramr/openshift-tornado-websockets which uses tornado for websocket and normal HTTP connection, i want to deal with both ws and http,I have successfully deployed the code over openshift. as per the code in binds to default internal port 8000 of openshift, but when i tried connect to ws://piot-cloudap.rhcloud.com:8000/ws-echo/ url end using python websocket client lib, it do connects to the ws URL, but when i tries to send some data, and then tries to receives it back it returns nothing just empty string, can someone point me what am doing wrong!

client side code that am using:

ws = create_connection("ws://piot-cloudap.rhcloud.com:8000/ws-echo/")
ws.send("test")
result =  ws.recv()
print result

But it returns null.

Any help would be appreciated.


回答1:


You need to bind to port 8080 within your application, but users access it on port 8000 externally. Also make sure that you are binding to your openshift ip address. You can refer to this page (https://developers.openshift.com/en/managing-port-binding-routing.html) of the Developer Portal for more information about how requests are routed to your application.



来源:https://stackoverflow.com/questions/34415774/openshift-tornado-websocketdemo-not-responding

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