Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed the close_connection issue #1

Merged
merged 2 commits into from

2 participants

@johnkchow

When I ran the demo, I noticed that the connections to the Redis server still persisted even after the websocket closed. I updated the Gemfile to pull the "em-hiredis" directly from mloughran's Github instead of RubyGems (the RubyGems's version didn't have a Client#close_connection method). Additionally, I updated your method call from "close_connection_after_writing" to "close_connection" which previously wouldn't close the connection.

Just wanted to say it was a great demo, and I hope these fixes will help the next developer who stumbles upon it :).

@lifo lifo merged commit 05a90ee into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 6 deletions.
  1. +1 −1  Gemfile
  2. +8 −3 Gemfile.lock
  3. +2 −2 app/actions/chat_action.rb
View
2  Gemfile
@@ -6,5 +6,5 @@ gem 'thin'
gem 'http_router'
gem 'async-rack'
-gem 'em-hiredis'
+gem 'em-hiredis', :git => "git://github.com/mloughran/em-hiredis.git"
gem 'yajl-ruby'
View
11 Gemfile.lock
@@ -1,3 +1,10 @@
+GIT
+ remote: git://github.com/mloughran/em-hiredis.git
+ revision: ff07044584aa20461707269d802f2caf55063a36
+ specs:
+ em-hiredis (0.1.0)
+ hiredis (~> 0.3.0)
+
GEM
remote: http://rubygems.org/
specs:
@@ -10,8 +17,6 @@ GEM
rack (~> 1.3.2)
thor (~> 0.14.6)
daemons (1.1.4)
- em-hiredis (0.1.0)
- hiredis (~> 0.3.0)
eventmachine (1.0.0.beta.3)
hiredis (0.3.2)
http_router (0.10.2)
@@ -33,7 +38,7 @@ PLATFORMS
DEPENDENCIES
async-rack
cramp (~> 0.15.1)
- em-hiredis
+ em-hiredis!
http_router
thin
yajl-ruby
View
4 app/actions/chat_action.rb
@@ -9,8 +9,8 @@ def create_redis
end
def destroy_redis
- @pub.close_connection_after_writing
- @sub.close_connection_after_writing
+ @pub.close_connection
+ @sub.close_connection
end
def received_data(data)
Something went wrong with that request. Please try again.