You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|prefix_filter `String`|**Default: `None`** <br> Filter the channels returned by their prefix |
78
+
|attributes `Collection` | **Default: `[]`** <br> A collection of attributes which should be returned for each channel. If empty, an empty dictionary of attributes will be returned for each channel. <br> Available attributes: `"user_count"`.
79
+
80
+
|Return Values |Description |
81
+
|:-:|:-:|
82
+
|channels `Dict`| A parsed response from the HTTP API. See example. |
|channel `String`|**Required** <br> The name of the channel you wish to query|
99
+
|attributes `Collection` | **Default: `[]`** <br> A collection of attributes to be returned for the channel. <br><br> Available attributes: <br> `"user_count"` : Number of *distinct* users currently subscribed. **Applicable only to presence channels**. <br> `"subscription_count"`: [BETA]: Number of *connections* currently subscribed to the channel. Please [contact us](http://support.pusher.com) to enable this feature.
100
+
101
+
|Return Values |Description |
102
+
|:-:|:-:|
103
+
|channel `Dict`| A parsed response from the HTTP API. See example. |
In order for users to subscribe to a private- or presence-channel, they must be authenticated by your server.
137
+
138
+
The client will make a POST request to an endpoint (either "/pusher/auth" or any which you specify) with a body consisting of the channel's name and socket_id.
139
+
140
+
Using your `Config` instance, with which you initialized `Pusher`, you can generate an authentication signature. Having responded to the request with this signature, the subscription will be authenticated.
141
+
142
+
|Argument |Description |
143
+
|:-:|:-:|
144
+
|channel `String`|**Required**<br> The name of the channel, sent to you in the POST request |
145
+
|socket_id `String`|**Required**<br> The channel's socket_id, also sent to you in the POST request |
146
+
|custom_data `Dict`|**Required for presence channels** <br> This will be a dictionary containing the data you want associated with a member of a presence channel. A `"user_id"` key is *required*, and you can optionally pass in a `"user_info"` key. See the example below. |
147
+
148
+
|Return Values |Description |
149
+
|:-:|:-:|
150
+
|response `Dict`| A dictionary to send as a response to the authentication request.|
The Config and Pusher constructors supports more options. See the code
64
-
documentation to get all the details.
191
+
If you have webhooks set up to POST a payload to a specified endpoint, you may wish to validate that these are actually from Pusher. The `Config` object achieves this by checking the authentication signature in the request body using your application credentials.
65
192
66
-
TODO: Add link to code docs here
193
+
#### `Config::validate_webhook`
194
+
195
+
|Argument |Description |
196
+
|:-:|:-:|
197
+
|key `String`|**Required**<br>Pass in the value sent in the request headers under the key "X-PUSHER-KEY". The method will check this matches your app key. |
198
+
|signature `String`|**Required**<br>This is the value in the request headers under the key "X-PUSHER-SIGNATURE". The method will verify that this is the result of signing the request body against your app secret. |
199
+
|body `String`|**Required**<br>The JSON string of the request body received. |
200
+
201
+
|Return Values |Description |
202
+
|:-:|:-:|
203
+
|body_data `Dict`| If validation was successful, the return value will be the parsed payload. Otherwise, it will be `None`. |
0 commit comments