Skip to content

Instantly share code, notes, and snippets.

@joshcutler
Created June 28, 2011 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcutler/1051435 to your computer and use it in GitHub Desktop.
Save joshcutler/1051435 to your computer and use it in GitHub Desktop.
Pusher controller
class PusherController < ApplicationController
def auth
if current_user
response = Pusher[params[:channel_name]].authenticate(params[:socket_id], {
:user_id => current_user.id,
:user_info => {
:username => current_user.username,
:status => Point.user_status(current_user),
:list_html => render_to_string(:partial => "chat_messages/user", :locals => {:user => current_user})
}
})
render :json => response
else
render :text => "Not authorized", :status => '403'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment