realtime 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddeb54e047fe444ad96f0ca4307e47878bbf69b9
4
- data.tar.gz: a14d656cdbd3080033ae3b5f7a0f8f5c0c6f156b
3
+ metadata.gz: 79483830c5901410b149cb9bbe9ff5e550f664b3
4
+ data.tar.gz: 2482b7fafe2cd03287f5571324132ea0cc231f71
5
5
  SHA512:
6
- metadata.gz: 58d72dfb869afb8f373c029bdf5c675e33fa924d02695bdc32eba48045e53e5bf0aebefd25d916530ca685bad06c7d777c13264d17d62126207c10d913034a8d
7
- data.tar.gz: dfc0462a33d0138649da1e12014861d78f6e99236c1687acab31ac73d349ec9adf16282585ccc76f64ed7aeb0841b58d2acc7709d8f51b5f147c3bc795693f5d
6
+ metadata.gz: 5c29a63cb0ca55340755bb18bc82e93feeafe5ab2ebd6d48a21f390a005eb48f6ab790348d77b899651981b9df28a19ef9b1cec5697e25801646d87c607b95e0
7
+ data.tar.gz: 3a7c96950cd32c9355ec70ec50e020b8dc45695cbfacd195b93e0d9e98c79f70fa41f1a5dc515657c2a38b96785832ee40a7685feee40faad8065835439a969b
@@ -1,59 +1,53 @@
1
- module Realtime
2
- module Controller
3
- extend ActiveSupport::Concern
4
-
5
- module ClassMethods
6
- def realtime_controller
7
- before_filter :do_realtime_token
8
- before_filter :do_realtime_domain
9
- before_filter :do_realtime_user_id
10
- before_filter :do_realtime_server_url
11
- after_filter :store_realtime_session
12
- end
13
- end
14
-
15
- def do_realtime_token
16
- @realtime_token = Digest::MD5.hexdigest("#{session[:session_id]}:#{realtime_user_id}")
17
- return @realtime_token
18
- end
19
-
20
- def do_realtime_domain
21
- @realtime_domain = realtime_domain
22
- return @realtime_domain
23
- end
24
-
25
- def do_realtime_user_id
26
- @realtime_user_id = realtime_user_id
27
- return @realtime_user_id
28
- end
29
-
30
- def do_realtime_server_url
31
- @realtime_server_url = realtime_server_url
32
- return @realtime_server_url
33
- end
34
-
35
- # create shared session tokens for redis/socketio realtime server running on node.js
36
- def store_realtime_session
37
- # store session data or any authentication data you want here, generate to JSON data
38
- session_data = {
39
- "user_id" => realtime_user_id,
40
- }
41
-
42
- # todo: merge additional session data passed in
43
-
44
- stored_session_data = JSON.generate(session_data)
45
-
46
- RedisWrapper.redis.hset(
47
- "rtSession-" + realtime_user_id.to_s,
48
- @realtime_token,
49
- stored_session_data,
50
- )
51
-
52
- # expire this realtime session after one day.
53
- RedisWrapper.redis.expire("rtSession-" + realtime_user_id.to_s, 86400)
54
-
55
-
56
- end
57
-
58
- end
1
+ module Realtime
2
+ module Controller
3
+ extend ActiveSupport::Concern
4
+
5
+ module ClassMethods
6
+ def realtime_controller
7
+ before_filter :do_realtime_token
8
+ before_filter :do_realtime_user_id
9
+ before_filter :do_realtime_server_url
10
+ after_filter :store_realtime_session
11
+ end
12
+ end
13
+
14
+ def do_realtime_token
15
+ @realtime_token = Digest::MD5.hexdigest("#{session[:session_id]}:#{realtime_user_id}")
16
+ return @realtime_token
17
+ end
18
+
19
+ def do_realtime_user_id
20
+ @realtime_user_id = realtime_user_id
21
+ return @realtime_user_id
22
+ end
23
+
24
+ def do_realtime_server_url
25
+ @realtime_server_url = realtime_server_url
26
+ return @realtime_server_url
27
+ end
28
+
29
+ # create shared session tokens for redis/socketio realtime server running on node.js
30
+ def store_realtime_session
31
+ # store session data or any authentication data you want here, generate to JSON data
32
+ session_data = {
33
+ "user_id" => realtime_user_id,
34
+ }
35
+
36
+ # todo: merge additional session data passed in
37
+
38
+ stored_session_data = JSON.generate(session_data)
39
+
40
+ RedisWrapper.redis.hset(
41
+ "rtSession-" + realtime_user_id.to_s,
42
+ @realtime_token,
43
+ stored_session_data,
44
+ )
45
+
46
+ # expire this realtime session after one day.
47
+ RedisWrapper.redis.expire("rtSession-" + realtime_user_id.to_s, 86400)
48
+
49
+
50
+ end
51
+
52
+ end
59
53
  end
@@ -1,3 +1,3 @@
1
1
  module Realtime
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: realtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Atlas
@@ -55,7 +55,6 @@ files:
55
55
  - lib/realtime/view_helpers.rb
56
56
  - lib/realtime.rb
57
57
  - MIT-LICENSE
58
- - README.rdoc
59
58
  homepage: https://github.com/mikeatlas/realtime-rails
60
59
  licenses:
61
60
  - MIT
data/README.rdoc DELETED
@@ -1 +0,0 @@
1
- = Realtime Support for Rails