问题
I register in the Openshift.com and create a catridge. But when I need to deploy Mosquitto, a MQTT Server, which is accessed through tcp or ssl protocol, and I need visit from public IP. Does Openshift just redirect http/https protocol through 80/443 port to 8080? Is it possible to use socket communcation in Openshift?
I have created two applications in Openshift, one for push and the other for web deployment, and I stopped the apache service in order to let the mosquitto service listen to 8080. But only if I send post request in https protocol, It can access to the server for a while and disconnect.
回答1:
I think this might point you in the right direction https://www.openshift.com/blogs/paas-websockets.
回答2:
To save some readings from the readers, the steps involved in niharvey's answer:
- Create a diy app in your openshift account.
- Git checkout the code.
- Add a websocket app of your own choice that would bind to
$OPENSHIFT_DIY_IP:$OPENSHIFT_DIY_PORT
. - Modify the action hooks for starting and stopping your app. Push the code.
- From the client, connect to port
8000
forws://
or8443
forwss://
, by your app url.
Just verified these steps do work as expected.
来源:https://stackoverflow.com/questions/20654119/how-can-i-access-socket-through-openshift