WebSockets with SSL on Heroku - issues in Chrome and FireFox - ruby-on-rails

I have a chat application hosted on Heroku that is using WebSockets. The app is Rails 4.0.1 and Ruby 2.0.0 and is using the gem 'websocket-rails'.
The application was working fine in Safari, Chrome and Firefox when I was using standard http://. Then today I added SSL endpoint on Heroku. Now, the app works fine in Safari, but in Chrome and Firefox it will take > 1 minute to load any page (even just a static page). It is getting hung up on something (I'm guessing the WebSocket connection) but I am having a hard time debugging the root problem. Any ideas or things to try would be greatly appreciated.
The app is: http://www.chat-correct.com. If you try it in Safari it should load the pages relatively fast, but if you try it in Chrome or Firefox you will see that it hangs.
I am using:
Safari Version 6.1 (8537.71)
Chrome Version 31.0.1650.39 beta
Firefox Version 22
UPDATE
I have narrowed the issue down and it seems to be with using the thin web server:
Thin web server (v1.6.1 codename Death Proof)
If I switch the app to WEBrick, the Chrome/Firefox issue disappears. However, the web socket-rails gem doesn't work with WEBrick and only seems to support only event machine based web servers (thus Unicorn/Puma is out of the question).

Try Rainbows!. http://rainbows.rubyforge.org/ It is based on unicorn and also can be configured to use EventMachine for network concurrency. Though to be fair, I ran into your question because I have a similar issue on rainbows. Anyway, I have a slightly different setup so it may not be an issue for you.

Related

puma-dev link not working under Linux

I'm work on Linux and I develop a Ruby on Rails application.
I've set up the puma-dev seeing this page and they say, if you are working on Linux, please setup dev-tld-resolver.
I have completed both setups and I want to test if they work correctly.
I linked puma-dev to my Rails app and run it in the foreground with the -sysbind option. It runs, but if I type the URL (myapp.dev), it does not work.
How can I solve this problem?
I solved the problem myself.
The problem was Firefox. Firefox not support .dev domain so it couldn't connect to my application.
As I turn my app with Google Chrome, it executed correctly.

Rails server hanging even with even freshly created app

My rails server started hanging today, so I tried running different apps to see if the issue was caused by my app, even created an empty app and with that even the default page doesn't come up.
I've been using it as just an http server, testing front-end with adding files into the public folder, so, I don't even compile any actual ruby code, just plain HTML, CSS and JS.
When I try to browse localhost:3000, the page is unresponsive, I can't even view source and I'd like to add that this happens with Chrome, Safari, IE and Edge, so I don't think it's a caching issue on the browser front.
I tried running the server on a specific ip and port, also tried the 0.0.0.0 trick mentioned on some other questions, doesn't help me so far.
I'm using ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15] and Rails 4.2.5.
Any ideas?
Well, I ended up resolving the issue by uninstalling and reinstalling the whole stack. Couldn't find the reason behind the issue but if you get stuck with the same problem, apparently a complete reinstall fixes it...

Slow assets ruby 1.9.3, macos, rails 3.2

Im have a really weird issue, my assets served really slow in development(10 sec per file), thia happens only in Chrome(17.0.963.79). In Firefox all works just fine.
My setup:
RVM
Ruby-1.9.3#p125
Rails 3.2.0
Mac OS 10.7.3
I have tried switch from webrick to mongrel and thin, using rails-dev-tweaks gem, set cache classes to true and false. All this didnt help, im stuck why it's work slow only in chrome and not in firefox? Also this is fresh setup of OS, maybe im missing something, thanks!
UPD. If this initial request(e.g. from new tab) all goes smooth. Request take near 2 minute only if im refreshing page. I just can't wrap my head around this issue :(
This seems to have something to do with name resolution.
Using (chrome) and
localhost:3000/ -- great performance
127.0.0.1:3000/ -- great performance
hostname.local:3000/ - Terrible performance as you describe
This is unfortunate for me, as I have an alias set up in /etc/hosts to point to 127.0.0.1 that affects how the page gets displayed. So no testing of that in chrome.
I had the same problem.
Try setting config.assets.debug = false in development.rb. It helped in my case.
We ran into this issue and solved it through using a pow server since it resolves to port 80.
To install pow
curl get.pow.cx | sh
Here is a link to the source for the paranoid.
Hope that helps.

rails 3.2.1 very slow in development mode

Since i upgrade my app on my development server, the request are terribly slow. Event if the log seems to render quite quickly, it take 10-15 second for the loading to be complete (event if the page is already fully loaded)
My configuration :
Rails 3.2.1
Ruby 1.9.3-p125 (rvm)
Standalone Passenger (3.0.11)
I do not have this kind of issue on my development machine, so i guess the problem is not coming from my application
I had a very similar problem. Found this question ( Slow assets ruby 1.9.3, macos, rails 3.2 ) which helped me discover it was chrome where the problem was occurring. Still don't know why, or how to fix it.
In my case it was Rails Panel extension that was slowing Chrome. I just disabled it and it the app became 3 times faster.

Cookies not saving

I'm working on an application in localhost:3000 and I just started working with cookies and can't get them to stay saved after I quit out of chrome. I checked my preferences and they were fine, cookies from other websites like stackoverflow are being retained. I've tried multiple ways of saving the cookies including
cookies.permanent[:guest_user_id] = create_guest_user.id
and it's not working (create_guest_user is a method for implementing a guest_user, taken from https://github.com/plataformatec/devise/wiki/How-To:-Create-a-guest-user). Also, Devise isn't saving anything either when I check remember me at the login page. I even added
Devise::TRUE_VALUES << ["on"]
as was recommended by another post and that didn't work for me either. I'm using rails 3.1.1, formtastic 2.0.2, and devise 1.5.1. I'm running Mac OS 10.6.8 and chrome 15.0.874.121. Thanks for the help.
UPDATE: I even tried changing my hosts file as was recommended here Can I use localhost as the domain when setting an HTTP cookie? and it still isn't working. Am I missing something obvious?
I guess there just isn't a relatively easy way of solving this problem in chrome. I tried out a bunch of solutions from various sources with little success. Not sure why google has this design in chrome as its developer tools are great and I'm reluctant to switch browsers.

Resources