pusher-hackathon 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -12
- data/lib/hackathon/version.rb +1 -1
- data/lib/hackathon.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1452fc461d4d8bcb72914fc68946f50700123ad2
|
4
|
+
data.tar.gz: b29fa9cf62e662e2688dae220e9bec79cc48807d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e168ca29cf1b02aa34a23dcbcc16605f57a5642f9f996f8c788e6268cdcc8dc63ef6a50858ff67d56a52cf3cf2e5c5e53d54d8a472913a3e678b28c6bfbc0ec
|
7
|
+
data.tar.gz: f0ba9eb7507b7ea18476ea5e181de4544e7ab193effcd334ee6f44f369ec4ab56d4209456e837a74a65331d7a15ced679238e28251eb0cf612edf4dc66c7f14c
|
data/README.md
CHANGED
@@ -1,26 +1,38 @@
|
|
1
|
-
#
|
1
|
+
# Hackauthon
|
2
2
|
|
3
|
-
|
3
|
+
Setting up a server that authenticates private- and presence-channels for hackathon attendees, so they have more time to get hacking.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
$ gem install pusher-hackathon
|
8
8
|
|
9
|
-
|
10
|
-
gem 'pusher-hackathon'
|
11
|
-
```
|
9
|
+
## Usage
|
12
10
|
|
13
|
-
|
11
|
+
Simply run the `pusher-hackathon` command, with your app's `id`, `key`, and `secret` as options. If you wish, you can choose to specify a `port`.
|
14
12
|
|
15
|
-
$
|
13
|
+
$ pusher-hackathon run --id your_app_id \
|
14
|
+
--secret your_app_secret \
|
15
|
+
--key your_app_key \
|
16
|
+
[--port your_port]
|
16
17
|
|
17
|
-
|
18
|
+
This will set up a Sinatra server for you. The default port it will be running on is `9090`.
|
18
19
|
|
19
|
-
|
20
|
+
Then, in your Javascript code, make the Pusher connection point to this server's `pusher/auth` endpoint for authentication. For presence-channels, you can also specify information to be associated with a channel member. A `user_id` is required, and `user_info` is optional.
|
20
21
|
|
21
|
-
|
22
|
+
```js
|
23
|
+
var pusher = new Pusher('APP_KEY', {
|
24
|
+
authEndpoint: "http://localhost:9090/pusher/auth", // 9090 can be substituted for the port you specified.
|
25
|
+
|
26
|
+
auth: {
|
27
|
+
params: {
|
28
|
+
user_id: 1,
|
29
|
+
user_info: JSON.stringify({twitter: "pusher"}) // optional
|
30
|
+
}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
```
|
22
34
|
|
23
|
-
|
35
|
+
Boom, job done! Now get hacking!
|
24
36
|
|
25
37
|
## Contributing
|
26
38
|
|
data/lib/hackathon/version.rb
CHANGED
data/lib/hackathon.rb
CHANGED
@@ -10,8 +10,8 @@ module PusherHackathon
|
|
10
10
|
response['Access-Control-Allow-Origin'] = '*'
|
11
11
|
|
12
12
|
Pusher[params[:channel_name]].authenticate(params[:socket_id], {
|
13
|
-
user_id: params[:user_id],
|
14
|
-
user_info: JSON.parse(params[:user_info])
|
13
|
+
user_id: params[:user_id] || 1,
|
14
|
+
user_info: JSON.parse(params[:user_info] || {twitter: 'pusher'}.to_json)
|
15
15
|
}).to_json
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pusher-hackathon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|