Skip to content

Feat/authenticate user #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: feat/authenticate-user
Choose a base branch
from
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