Openshift龙卷风WebSocket(演示)没有响应 [英] Openshift Tornado WebSocket(Demo) not responding

查看:98
本文介绍了Openshift龙卷风WebSocket(演示)没有响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在openshift上用python托管websocket应用,我发现了这个仓库: https://github.com/ramr/openshift-tornado-websockets 使用龙卷风进行websocket和普通HTTP连接,我想同时处理ws和http,我已经在openshift上成功部署了代码.按照中的代码绑定到openshift的默认内部端口8000, 但是,当我尝试使用python websocket客户端lib连接到ws://piot-cloudap.rhcloud.com:8000/ws-echo/网址结尾时,它确实连接到了ws URL, 但是当我尝试发送一些数据然后尝试将其接收回来时,它什么也没有返回,只是空字符串,有人可以指出我做错了什么!

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

但是它返回null.

任何帮助将不胜感激.

推荐答案

您需要绑定到应用程序中的端口8080,但用户需要从外部访问端口8000.还要确保您绑定到您的openshift ip地址.您可以参考此页面( https://developers.openshift.com/zh_/managing-port-binding-routing.html ),以获取有关如何将请求路由到您的应用程序的更多信息.

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.

这篇关于Openshift龙卷风WebSocket(演示)没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆