Dotcloud www and TCP in one application -

I am trying to start a nodejs socket server that will allow remote communication between two clients launching a flash game that communicates using a custom protocol. Due to Flash security restrictions, it seems that the socket server should be running on the same host as the web server that is loading the Flash game. I constantly get the following error:

The service crashed at startup or is listening to the wrong port. It failed to respond on port "nodejs" (8080) within 30 seconds 

I need a way to run nodeJS host code while providing flash files.

I use JSON variables to determine which port to listen on, and my YML is like the one discussed here , but no luck ... Just wondering if I can get some information on how to create a working socket server / web server that will work for this (or if it is really possible)

+2
source share
1 answer

You can use the following dotcloud.yml file:

 www: type: nodejs ports: mything: tcp 

Then, in your Node.js application, you can bind an HTTP server to port 8080 and an arbitrary TCP server to a port containing the $PORT_MYTHING environment variable. Then run dotcloud info on your service; in the ports section you will see something like this:

 - name: mything url: tcp://myapp-johndoe.dotcloud.com:12345 

From now on, if you connect to myapp-johndoe.dotcloud.com on port 12345 , you really connect to $PORT_MYTHING in your application.

I hope this makes sense and that this is what you were looking for!

+4
source

Source: https://habr.com/ru/post/1432314/


All Articles