WebFaction
Community site: login faq
0
1

In the past years it has become easier to create a nodejs app and special ports for websockets are now available even for shared servers, both via https://my.webfaction.com/new-application. Combining these two however is not trivial: the 'App category' widget lets you choose between a 'Node' app and a 'Websockets app'. If your want your Node app to use websockets, you need to choose 'websockets' and then install the Node part somehow yourself, although it says that 'the custom application (read: Node) is not required to reside there (read: in the newly created Websocket app directory). Creating a Node app first, then the 'Websocket app' and using the port given from this websocket app in the Node app to listen to, does not work.

So what is the suggested way at this date (2016) to create a Node app that uses websockets, e.g. with the socket.io module?

asked 27 Apr '16, 16:13

expdesign
1327
accept rate: 0%


Creating a Node app first, then the 'Websocket app' and using the port given from this websocket app in the Node app to listen to, does not work.

Actually it does, and is the recommended way to do Node with websockets on our platform. The specific steps are:

  1. Create a Node app via the control panel - this takes care of the Node install.
  2. Create 'custom websockets app listening on port' application - this gets you the ability to do websockets.
  3. Configure your Node app to listen on the port assigned to the websockets app (by editing index.js or whatever you're using to tell your app to listen on a port).
  4. Configure your site in the control panel to use the websockets app instead of the node app. This will set up the configuration in our front-end web server so that your websocket requests will make it to your app.

If you've done that and it's not working for you, then feel free to open a support ticket to let us know the specific problem you're seeing.

Hope that helps!

permanent link

answered 27 Apr '16, 16:25

seanf
12.2k31736
accept rate: 37%

"Configure your site in the control panel to use the websockets app instead of the node app": counter-intuitive but a very important hint. Also, in case of using socket.io, the option 'path' for the io.connect function should end on /socket.io/, eg, when the website for the websocket app is subdomain '/ws', use io.connect('/',{path:'/ws/socket.io'});

(28 Apr '16, 12:00) expdesign
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×65
×34
×27
×14
×4

question asked: 27 Apr '16, 16:13

question was seen: 2,282 times

last updated: 28 Apr '16, 12:00

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM