realtime 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/realtime.rb +6 -6
- data/lib/realtime/version.rb +3 -3
- data/lib/realtime/zmq_wrapper.rb +34 -32
- 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: f46ba0e1a4556a4a0a74f17d3198195be387dcae
|
4
|
+
data.tar.gz: f42f5e4d262a44a5250fe9f80da4bbe0872346ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7d8dfd3151901e94a8bcd38ac09e1da9132b0ed6af1e17c703065e03654db96f7da54e657eecfdbf04602fdfd9e435f06a5360791dcd8164d0d572aaae9bfff
|
7
|
+
data.tar.gz: a2295c74cdce6fbf33002c4070d4bf1f3170f7a0f350cd267d58a586d2a07c9a80b0e8d5a52c5f0a6e35e9e9ae669113066b729edd52208e80944a20349d143a
|
data/lib/realtime.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
require "realtime/realtime_controller.rb"
|
3
|
-
require "realtime/redis_wrapper.rb"
|
4
|
-
require "realtime/zmq_wrapper.rb"
|
5
|
-
require 'realtime/view_helpers.rb'
|
6
|
-
require 'realtime/railtie.rb'
|
1
|
+
|
2
|
+
require "realtime/realtime_controller.rb"
|
3
|
+
require "realtime/redis_wrapper.rb"
|
4
|
+
require "realtime/zmq_wrapper.rb"
|
5
|
+
require 'realtime/view_helpers.rb'
|
6
|
+
require 'realtime/railtie.rb'
|
data/lib/realtime/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Realtime
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
1
|
+
module Realtime
|
2
|
+
VERSION = "0.0.10"
|
3
|
+
end
|
data/lib/realtime/zmq_wrapper.rb
CHANGED
@@ -1,32 +1,34 @@
|
|
1
|
-
class ZmqWrapper
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
1
|
+
class ZmqWrapper
|
2
|
+
|
3
|
+
if defined?(ZMQ) && defined?(EmZeromq)
|
4
|
+
require 'em-zeromq'
|
5
|
+
|
6
|
+
def self.publish(the_message)
|
7
|
+
EM.run {
|
8
|
+
zmq = EM::ZeroMQ::Context.new(1)
|
9
|
+
pusher = zmq.socket(ZMQ::PUSH)
|
10
|
+
pusher.connect($zmq_server)
|
11
|
+
message = "realtime_msg:" + the_message.to_json
|
12
|
+
puts "Pushing realtime message: " + message
|
13
|
+
pusher.send_msg(message)
|
14
|
+
EM.stop
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.store_session(user_id, session_id, session_data, expiration)
|
19
|
+
EM.run {
|
20
|
+
zmq = EM::ZeroMQ::Context.new(1)
|
21
|
+
pusher = zmq.socket(ZMQ::PUSH)
|
22
|
+
pusher.connect($zmq_server)
|
23
|
+
the_message = {user_id: user_id,
|
24
|
+
session_id: session_id,
|
25
|
+
session_data: session_data,
|
26
|
+
expiration: expiration}
|
27
|
+
message = "rtSession:" + the_message.to_json
|
28
|
+
puts "Pushing session message: " + message
|
29
|
+
pusher.send_msg(message)
|
30
|
+
EM.stop
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: realtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Atlas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|