@@ -17,7 +17,7 @@ var pusherPathRegex = regexp.MustCompile("^/apps/([0-9]+)$")
17
17
var maxTriggerableChannels = 100
18
18
19
19
const (
20
- libraryVersion = "5.1.0 "
20
+ libraryVersion = "5.1.1 "
21
21
libraryName = "pusher-http-go"
22
22
)
23
23
@@ -65,7 +65,6 @@ type Client struct {
65
65
ClientFromURL allows client instantiation from a specially-crafted Pusher URL.
66
66
67
67
c := pusher.ClientFromURL("http://key:secret@api.pusherapp.com/apps/app_id")
68
-
69
68
*/
70
69
func ClientFromURL (serverURL string ) (* Client , error ) {
71
70
url2 , err := url .Parse (serverURL )
@@ -104,8 +103,8 @@ func ClientFromURL(serverURL string) (*Client, error) {
104
103
ClientFromEnv allows instantiation of a client from an environment variable.
105
104
This is particularly relevant if you are using Pusher as a Heroku add-on,
106
105
which stores credentials in a `"PUSHER_URL"` environment variable. For example:
107
- client := pusher.ClientFromEnv("PUSHER_URL")
108
106
107
+ client := pusher.ClientFromEnv("PUSHER_URL")
109
108
*/
110
109
func ClientFromEnv (key string ) (* Client , error ) {
111
110
url := os .Getenv (key )
@@ -139,7 +138,6 @@ be marshallable into JSON.
139
138
140
139
data := map[string]string{"hello": "world"}
141
140
client.Trigger("greeting_channel", "say_hello", data)
142
-
143
141
*/
144
142
func (c * Client ) Trigger (channel string , eventName string , data interface {}) error {
145
143
_ , err := c .validateChannelsAndTrigger ([]string {channel }, eventName , data , TriggerParams {})
@@ -201,6 +199,7 @@ func (c *Client) TriggerWithParams(
201
199
/*
202
200
TriggerMulti is the same as `client.Trigger`, except one passes in a slice of
203
201
`channels` as the first parameter. The maximum length of channels is 100.
202
+
204
203
client.TriggerMulti([]string{"a_channel", "another_channel"}, "event", data)
205
204
*/
206
205
func (c * Client ) TriggerMulti (channels []string , eventName string , data interface {}) error {
@@ -226,6 +225,7 @@ func (c *Client) TriggerMultiWithParams(
226
225
TriggerExclusive triggers an event excluding a recipient whose connection has
227
226
the `socket_id` you specify here from receiving the event.
228
227
You can read more here: http://pusher.com/docs/duplicates.
228
+
229
229
client.TriggerExclusive("a_channel", "event", data, "123.12")
230
230
231
231
Deprecated: use TriggerWithParams instead.
@@ -240,6 +240,7 @@ func (c *Client) TriggerExclusive(channel string, eventName string, data interfa
240
240
TriggerMultiExclusive triggers an event to multiple channels excluding a
241
241
recipient whose connection has the `socket_id` you specify here from receiving
242
242
the event on any of the channels.
243
+
243
244
client.TriggerMultiExclusive([]string{"a_channel", "another_channel"}, "event", data, "123.12")
244
245
245
246
Deprecated: use TriggerMultiWithParams instead.
@@ -466,7 +467,6 @@ method the channel name.
466
467
users, err := client.GetChannelUsers("presence-chatroom")
467
468
468
469
//users=> &{List:[{ID:13} {ID:90}]}
469
-
470
470
*/
471
471
func (c * Client ) GetChannelUsers (name string ) (* Users , error ) {
472
472
path := fmt .Sprintf ("/apps/%s/channels/%s/users" , c .AppID , name )
@@ -482,10 +482,10 @@ func (c *Client) GetChannelUsers(name string) (*Users, error) {
482
482
}
483
483
484
484
/*
485
- AuthenticateUser allows you to authenticate a user s subscription to a
486
- private channel. It returns an authentication signature to send back to the client
485
+ AuthenticateUser allows you to authenticate a user's connection.
486
+ It returns an authentication signature to send back to the client
487
487
and authenticate them. In order to identify a user, this method acceps a map containing
488
- arbitrary user data. It must contain at least and id field with the user's id as a string.
488
+ arbitrary user data. It must contain at least an id field with the user's id as a string.
489
489
490
490
For more information see our docs: http://pusher.com/docs/authenticating_users.
491
491
@@ -499,7 +499,8 @@ to send back to the client.
499
499
func pusherUserAuth(res http.ResponseWriter, req *http.Request) {
500
500
501
501
params, _ := ioutil.ReadAll(req.Body)
502
- response, err := client.AuthenticateUser(params)
502
+ userData := map[string]interface{} { "id": "1234", "twitter": "jamiepatel" }
503
+ response, err := client.AuthenticateUser(params, userData)
503
504
if err != nil {
504
505
panic(err)
505
506
}
@@ -680,8 +681,6 @@ occupied or vacated, members being added or removed in presence-channels, or
680
681
after client-originated events. For more information see
681
682
https://pusher.com/docs/webhooks.
682
683
683
-
684
-
685
684
If the webhook is valid, a `*pusher.Webhook* will be returned, and the `err`
686
685
value will be nil. If it is invalid, the first return value will be nil, and an
687
686
error will be passed.
0 commit comments