Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ pusher.authenticate('presence-my_channel', params[:socket_id],
)
```

## Authenticating Users
Respond to [User Authentication] (https://pusher.com/docs/channels/using_channels/user-authentication/) requests with the `authenticate_user` method.

``` ruby
user_data = { id: 'user_id', user_name: 'user_name' }
pusher.authenticate_user(params[:socket_id], user_data)
```

## Receiving WebHooks

A WebHook object may be created to validate received WebHooks against your app credentials, and to extract events. It should be created with the `Rack::Request` object (available as `request` in Rails controllers or Sinatra handlers for example).
Expand Down
2 changes: 1 addition & 1 deletion lib/pusher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class << self
def_delegators :default_client, :get, :get_async, :post, :post_async
def_delegators :default_client, :channels, :channel_info, :channel_users
def_delegators :default_client, :trigger, :trigger_batch, :trigger_async, :trigger_batch_async
def_delegators :default_client, :authenticate, :webhook, :channel, :[]
def_delegators :default_client, :authenticate, :webhook, :channel, :[], :authenticate_user
def_delegators :default_client, :notify

attr_writer :logger
Expand Down