问题
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