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
Copy file name to clipboardExpand all lines: README.md
+72-16Lines changed: 72 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
The Golang library for interacting with the Pusher Channels HTTP API.
6
6
7
-
This package lets you trigger events to your client and query the state of your Pusher channels. When used with a server, you can validate Pusher Channels webhooks and authenticate`private-` or `presence-` channels.
7
+
This package lets you trigger events to your client and query the state of your Pusher channels. When used with a server, you can validate Pusher Channels webhooks and authorize`private-` or `presence-` channels.
8
8
9
9
Register for free at <https://pusher.com/channels> and use the application credentials within your app as shown below.
10
10
@@ -21,7 +21,8 @@ Register for free at <https://pusher.com/channels> and use the application crede
@@ -146,7 +147,7 @@ pusherClient.Cluster = "eu" // in this case requests will be made to api-eu.push
146
147
147
148
This library supports end to end encryption of your private channels. This means that only you and your connected clients will be able to read your messages. Pusher cannot decrypt them. You can enable this feature by following these steps:
148
149
149
-
1. You should first set up Private channels. This involves [creating an authentication endpoint on your server](https://pusher.com/docs/authenticating_users).
150
+
1. You should first set up Private channels. This involves [creating an authorization endpoint on your server](https://pusher.com/docs/authorizing_users).
150
151
151
152
2. Next, generate a 32 byte master encryption key, base64 encode it and store
152
153
it securely.
@@ -371,35 +372,88 @@ for i, attributes := range response.Batch {
Application security is very important so Pusher Channels provides a mechanism for authenticating a user’s access to a channel at the point of subscription.
377
+
##### `func (c *Client) SendToUser`
377
378
378
-
This can be used both to restrict access to private channels, and in the case of presence channels notify subscribers of who else is also subscribed via presence events.
379
+
| Argument |Description |
380
+
| :-: | :-: |
381
+
| userId `string`| The id of the user who should receive the event. |
382
+
| event `string`| The name of the event you wish to trigger. |
383
+
| data `interface{}`| The payload you wish to send. Must be marshallable into JSON. |
This library provides a mechanism for generating an authentication signature to send back to the client and authorize them.
394
+
Pusher Channels provides a mechanism for authenticating users. This can be used to send messages to specific users based on user id and to terminate misbehaving user connections, for example.
381
395
382
396
For more information see our [docs](http://pusher.com/docs/authenticating_users).
383
397
398
+
#### `func (c *Client) AuthenticateUser`
399
+
400
+
| Argument | Description |
401
+
| :-: | :-: |
402
+
| params `[]byte`| The request body sent by the client |
403
+
404
+
| Return Value | Description |
405
+
| :-: | :-: |
406
+
| response `[]byte`| The response to send back to the client, carrying an authentication signature |
Application security is very important so Pusher Channels provides a mechanism for authorizing a user’s access to a channel at the point of subscription.
431
+
432
+
This can be used both to restrict access to private channels, and in the case of presence channels notify subscribers of who else is also subscribed via presence events.
433
+
434
+
This library provides a mechanism for generating an authorization signature to send back to the client and authorize them.
435
+
436
+
For more information see our [docs](http://pusher.com/docs/authorizing_users).
0 commit comments