My server is Webfaction running django. Current I need add the instant messaging into my app. So I need let server listen to another port number such as 9090 do accept the socket connection. But it seems that webfaction only open 80 port to developers, so how to open other port number on web faction to implement simple instant messaging. [additional] I do not want to use XMPP(openfire) or something like QuickBlox, I just want to implement own instant messaging...
2 Answers
In the Webfaction Control Panel, click on Domains/Websites -> Applications -> Add new application
. In the App category
pulldown, select Custom
, and in App type
select Custom app (listening on port)
. You should then see the following text (emphasis mine):
This installer assigns an unprivileged port on which custom software can listen.
This creates the ~/webapps// directory for your convenience; however, the custom application is not required to reside there.
After the installer has finished, configure your custom software to listen to the port number specified in the "port" field. If the application is configured in a website record, the front-end server proxies incoming requests at the specified URL to the assigned port.
Note: Custom applications are intended for handling HTTP traffic. If you need direct access to the port, please open a support ticket to request access to the assigned port.
Custom Applications documentation is available at: http://docs.webfaction.com/software/custom.html Website record documentation is available at: http://docs.webfaction.com/user-guide/websites.html
So, you'll need to decide if your instant messaging app will communicate via HTTP or through direct access to the port, and act accordingly. To keep things simple, I'd assume you'd want to use HTTP, but the choice is up to you. Make sure you read through the custom applications documentation first, though. This will truly be a custom app, so you'll need to write logic to check if the server is still running, restart it periodically if needed, apply cron
jobs, increase number of server instance running with increases in load, etc.
Good luck!

- 100,794
- 21
- 241
- 231
-
Thank you so much. But there is a new problem: I write a python script as server side listening to the port (webfaction gave me), and write a python client. Client send the message to that port. Firstly, I put the my python server script on the webfaction server and run it, and I run my client on my laptop but the client can not connect my server script. After that I put my client on the webfaction server too, and I run my server and my client script, they works well. I don't know why. The "Firewall" Problem? But the webfaction said "Open a port in the server firewall for the application. " – zproject89 Mar 18 '14 at 01:38
-
Thank you so much, the problem has been solved. The second problem's solution is choosing the secondary ip address for the website on webfaction. And in the script use the ip address as the host name directly. – zproject89 Mar 18 '14 at 14:49
It's on the documentation http://docs.webfaction.com/software/custom.html If you want an specific port you'll need to open a ticket: https://community.webfaction.com/questions/14771/open-custom-application-on-a-specific-port-to-serve-mongodb-httpd-for-simple-rest-interface
BTW, Webfaction have a QA community page more suitable for this kind of questions https://community.webfaction.com/

- 4,386
- 3
- 30
- 66