def authenticate(socket_id, custom_data = nil)
      custom_data = MultiJson.encode(custom_data) if custom_data
      auth = authentication_string(socket_id, custom_data)
      r = {:auth => auth}
      r[:channel_data] = custom_data if custom_data
      r
    end
def authenticate(socket_id, custom_data = nil)
      custom_data = MultiJson.encode(custom_data) if custom_data
      auth = authentication_string(socket_id, custom_data)
      r = {:auth => auth}
      r[:channel_data] = custom_data if custom_data
      r
    end
Generate the expected response for an authentication endpoint.
 See http://pusher.com/docs/authenticating_users for details.

 @example Private channels
   render :json => Pusher['private-my_channel'].authenticate(params[:socket_id])

 @example Presence channels
   render :json => Pusher['presence-my_channel'].authenticate(params[:socket_id], {
     :user_id => current_user.id, # => required
     :user_info => { # => optional - for example
       :name => current_user.name,
       :email => current_user.email
     }
   })

 @param socket_id [String]
 @param custom_data [Hash] used for example by private channels

 @return [Hash]

 @raise [Pusher::Error] if socket_id or custom_data is invalid

 @private Custom data is sent to server as JSON-encoded string