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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d51386293451f00ca5c30c478f81b44b5319f596
4
- data.tar.gz: 2fe074b98ff94585282dd45013ba26abb5f1280c
3
+ metadata.gz: f46ba0e1a4556a4a0a74f17d3198195be387dcae
4
+ data.tar.gz: f42f5e4d262a44a5250fe9f80da4bbe0872346ea
5
5
  SHA512:
6
- metadata.gz: d82fa7edbc079e5db5bf883e06b38fe189be50302e95c19548a068f6b4001c5d7170e4a4268969a409cb65def6f3ccb36ee58a8f359e33efb543f3200b43f8a3
7
- data.tar.gz: 73e0f8b6669caaba4067d9a3bdb6312c857f853a272b7792075b1c830198786fd87584a5698dad6b2cf19109abef6f8891bf02b3da4a0ea27aa31b3e9f9f0608
6
+ metadata.gz: d7d8dfd3151901e94a8bcd38ac09e1da9132b0ed6af1e17c703065e03654db96f7da54e657eecfdbf04602fdfd9e435f06a5360791dcd8164d0d572aaae9bfff
7
+ data.tar.gz: a2295c74cdce6fbf33002c4070d4bf1f3170f7a0f350cd267d58a586d2a07c9a80b0e8d5a52c5f0a6e35e9e9ae669113066b729edd52208e80944a20349d143a
@@ -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'
@@ -1,3 +1,3 @@
1
- module Realtime
2
- VERSION = "0.0.9"
3
- end
1
+ module Realtime
2
+ VERSION = "0.0.10"
3
+ end
@@ -1,32 +1,34 @@
1
- class ZmqWrapper
2
-
3
- require 'em-zeromq'
4
-
5
- def self.publish(the_message)
6
- EM.run {
7
- zmq = EM::ZeroMQ::Context.new(1)
8
- pusher = zmq.socket(ZMQ::PUSH)
9
- pusher.connect($zmq_server)
10
- message = "realtime_msg:" + the_message.to_json
11
- puts "Pushing realtime message: " + message
12
- pusher.send_msg(message)
13
- EM.stop
14
- }
15
- end
16
-
17
- def self.store_session(user_id, session_id, session_data, expiration)
18
- EM.run {
19
- zmq = EM::ZeroMQ::Context.new(1)
20
- pusher = zmq.socket(ZMQ::PUSH)
21
- pusher.connect($zmq_server)
22
- the_message = {user_id: user_id,
23
- session_id: session_id,
24
- session_data: session_data,
25
- expiration: expiration}
26
- message = "rtSession:" + the_message.to_json
27
- puts "Pushing session message: " + message
28
- pusher.send_msg(message)
29
- EM.stop
30
- }
31
- end
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.9
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-03 00:00:00.000000000 Z
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails