WebFaction
Community site: login faq

I know that this question has been asked before (https://community.webfaction.com/questions/13027/nginx-and-websockets), but I wondered if there was any further status updates now that Nginx 1.4.4 appears to be the stable version. Is there a way to enable websockets via a .htaccess or something?

If this isn't possible I know that you can select the option to "Open a port in the server firewall for the application. " when creating the application, but then I can only access the websockets through the IP:PORT and not via the URL I assign the application in the websites tab. Is there anyway to use the URL to access the application via websockets? (The reason I need this is that I need the websockets to share session data with the site which was accessed via HTTP).

Thanks!

asked 31 Jan '14, 17:59

tractus
134
accept rate: 0%


It is being researched but has not been implemented yet, there is no ETA but there has been a lot of recent activity on the internal tracking ticket, so it is being worked on. For the time being you would use JavaScript in the browser DOM and have it load the websockets via IP:PORT transparent to the user.

permanent link

answered 01 Feb '14, 01:55

johns
5.3k312
accept rate: 23%

Thanks for your answer! It's good to hear that it's being worked on internally.

Loading the websockets via IP:PORT isn't a problem, the problem is that by doing that I don't have access to the site's cookies and session info. Do you have a suggestion of how maybe I could setup the site so I could use URL:PORT instead so I don't run into cross domain issues?

Thanks again for the update!

(01 Feb '14, 19:52) tractus

I'm not sure I understand. It sounds like what you're trying to do is to serve your entire site through the open port so that requests never hit the front-end webserver at all, but that's the wrong approach. You wouldn't serve your entire site through the open port (including HTTP) -- you'd only serve WebSockets traffic through the open port. The domain would be the same in both cases; only the port would be different (i.e. mydomain.com:23456 vs mydomain.com:80) and most browsers shouldn't have cross-domain issues with that (and you can always set a header to overcome that as well).

In short, the open port should be for WebSockets traffic, nothing else, so all of your cookies and session info should be acquired from the HTTP request that loaded the page initially.

(02 Feb '14, 00:06) ryans ♦♦

Oh I get what you're saying. Don't use IP:PORT use DOMAIN:PORT!

Thanks!

(02 Feb '14, 05:53) tractus

Im completely noob on this, good read still.

permanent link

answered 02 Feb '14, 15:32

min0taur
112
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:

×186
×67
×29
×27

question asked: 31 Jan '14, 17:59

question was seen: 2,305 times

last updated: 02 Feb '14, 15:32

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