WebFaction
Community site: login faq

I have followed the instructions at http://community.webfaction.com/questions/4888/install-nodejs-with-express-framework to create a nodejs/socket.io app.

I have mapped the custom app to a website: http://mysite.org/myapp.

In the server code I have used the correct port number allocated while creating the app.

In the client code, I use this line to connect to socket.io: io.connect('http://mysite.org/myapp')

But I get this error: Failed to load resource: the server responded with a status of 404 (Not Found)http://mysite.org/socket.io/1/?t=1362254754023

This happens during the initial handshake I guess. What is puzzling is that the beginning of the url in the error message is http://mysite.org/socket.io and not http://mysite.org/myapp/socket.io.

Why does socket.io look for http://mysite.org/socket.io/... rather than http://mysite.org/myapp/socket.io/... ?

Thanks.

asked 02 Mar '13, 16:32

jarav
1314
accept rate: 0%


Hello,

You can configure the SocketIO "mount point" path with the "resource" configuration option:

resource defaults to /socket.io

The begin point where Socket.IO starts looking for incoming connections. This should be the same between the client and the server.

...However, you need to be careful, since you are running a "split" configuration for your website! From the web browser's point of view, the URL might be mydomain.com/myapp/socket.io, but once the request gets modified by the frontend Nginx server, your Node app is only going to receive a request for mydomain.com/socket.io. So you would very likely need to use a different configuration on the web browser client and the Node server.

Let me make this a little bit easier for you: By far, the easist, most consistent way to run Node/SocketIO is to give its own subdomain -- something like socket.mydomain.com. This is far superior to something like "mydomain.com/myapp/" because of the messy configuration and inconsistencies that you run into.

permanent link

answered 21 Aug '13, 18:10

likebike
3366
accept rate: 28%

I have exactly same issue here. Did you find any solution on this?

permanent link

answered 21 Aug '13, 15:24

yamasnax
11
accept rate: 0%

Thank you so much all details likebike! I know you answered my the other post, as well. You must be really good what you do. I will definitely try your advice. Appreciated.

permanent link

answered 22 Aug '13, 08:02

yamasnax
11
accept rate: 0%

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:

×34
×12
×8

question asked: 02 Mar '13, 16:32

question was seen: 4,627 times

last updated: 22 Aug '13, 08:02

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 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