Skip to content

Commit

Permalink
Add users_count to control JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ihower committed Aug 14, 2011
1 parent 4ef4096 commit e637f05
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/actions/chat_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def call_join
@pub.sadd @channel, @username

@pub.scard(@channel).callback do |value|
publish :action => 'control', :user => @username, :message => "joined the chat room. We have #{value} people now!"
publish :action => 'control', :user => @username,
:message => "joined the chat room. We have #{value} people now!",
:users_count => value
CrampPubsub::Application.logger.info "#{@username} join #{@channel}, #{value} people"
end
end
Expand All @@ -71,7 +73,7 @@ def handle_leave
@pub.srem @channel, @username

@pub.scard(@channel).callback do |value|
publish :action => 'control', :user => @username, :message => "left the chat room. We have #{value} people."
publish :action => 'control', :user => @username, :message => "left the chat room. We have #{value} people.", :users_count => value
CrampPubsub::Application.logger.info "#{@username} leave #{@channel}, #{value} people"
finish
end
Expand Down

0 comments on commit e637f05

Please sign in to comment.