real_time_rails 0.0.6 → 0.0.73

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.
@@ -12,11 +12,11 @@ module RealTimeRails
12
12
 
13
13
  def send_rtr_update
14
14
  # TODO figure out why i have to make 2 connections to send 2 messages instead of just one connection.
15
- mySock = TCPSocket::new('127.0.0.1', 2000)
15
+ mySock = TCPSocket::new("#{RealTimeRails.config["update_host"]}", "#{RealTimeRails.config["update_port"]}")
16
16
  mySock.puts("{\"command\":\"update1\",\"model\":\"#{self.class.name}\",\"id\":\"#{self.id}\"}")
17
17
  mySock.close
18
18
 
19
- mySock = TCPSocket::new('127.0.0.1', 2000)
19
+ mySock = TCPSocket::new("#{RealTimeRails.config["update_host"]}", "#{RealTimeRails.config["update_port"]}")
20
20
  mySock.puts("{\"command\":\"updateall\",\"model\":\"#{self.class.name}\"}")
21
21
  mySock.close
22
22
  end
@@ -24,11 +24,11 @@ module RealTimeRails
24
24
 
25
25
  def send_rtr_destroy
26
26
  # TODO figure out why i have to make 2 connections to send 2 messages instead of just one connection.
27
- mySock = TCPSocket::new('127.0.0.1', 2000)
27
+ mySock = TCPSocket::new("#{RealTimeRails.config["update_host"]}", "#{RealTimeRails.config["update_port"]}")
28
28
  mySock.puts("{\"command\":\"delete1\",\"model\":\"#{self.class.name}\",\"id\":\"#{self.id}\"}")
29
29
  mySock.close
30
30
 
31
- mySock = TCPSocket::new('127.0.0.1', 2000)
31
+ mySock = TCPSocket::new("#{RealTimeRails.config["update_host"]}", "#{RealTimeRails.config["update_port"]}")
32
32
  mySock.puts("{\"command\":\"updateall\",\"model\":\"#{self.class.name}\"}")
33
33
  mySock.close
34
34
  end
@@ -0,0 +1,11 @@
1
+
2
+ module RealTimeRails
3
+
4
+ def self.config
5
+ @@config_file_options ||= begin
6
+ config_path = Rails.root.join('config','realtimerails.yml')
7
+ YAML.load_file(config_path)[Rails.env.to_s]
8
+ end
9
+ end
10
+
11
+ end
@@ -1,6 +1,8 @@
1
1
  module RealTimeRails
2
- module RealTimeHelper
3
2
 
3
+
4
+ module RealTimeHelper
5
+
4
6
  def render_real_time(options = {})
5
7
  RealTimeRails::RtrHelper.new(options) do
6
8
  render options
@@ -85,7 +85,7 @@ module RealTimeRails
85
85
  def js_start_websocket
86
86
  "
87
87
  var Socket = \"MozWebSocket\" in window ? MozWebSocket : WebSocket;
88
- ws_#{@id} = new Socket('ws://localhost:8080');
88
+ ws_#{@id} = new Socket('ws://#{RealTimeRails.config["websocket_host"]}:#{RealTimeRails.config["websocket_port"]}');
89
89
  ws_#{@id}.onmessage = function(evt) {
90
90
  if(evt.data=='update'){real_time_update_#{@id}()};
91
91
  if(evt.data=='delete'){real_time_delete_#{@id}()};
@@ -1,5 +1,5 @@
1
1
  module RealTimeRails
2
2
 
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.73"
4
4
 
5
5
  end
@@ -3,6 +3,7 @@ require 'real_time_rails/real_time_helper.rb'
3
3
  require 'real_time_rails/render_real_time_controller.rb'
4
4
  require 'real_time_rails/ar.rb'
5
5
  require 'real_time_rails/rt_helper.rb'
6
+ require 'real_time_rails/config.rb'
6
7
 
7
8
  if defined?(ActionView::Base)
8
9
  ActionView::Base.send :include, RealTimeRails::RealTimeHelper
data/realtimerails.yml ADDED
@@ -0,0 +1,11 @@
1
+ development:
2
+ websocket_host: 127.0.0.1
3
+ websocket_port: 8080
4
+ update_host: 127.0.0.1
5
+ update_port: 2000
6
+ production:
7
+ websocket_host: 127.0.0.1
8
+ websocket_port: 8080
9
+ update_host: 127.0.0.1
10
+ update_port: 2000
11
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: real_time_rails
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.73
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kelly Mahan
@@ -51,11 +51,13 @@ files:
51
51
  - bin/real_time_rails
52
52
  - lib/real_time_rails.rb
53
53
  - lib/real_time_rails/ar.rb
54
+ - lib/real_time_rails/config.rb
54
55
  - lib/real_time_rails/real_time_helper.rb
55
56
  - lib/real_time_rails/render_real_time_controller.rb
56
57
  - lib/real_time_rails/rt_helper.rb
57
58
  - lib/real_time_rails/version.rb
58
59
  - real_time_rails.gemspec
60
+ - realtimerails.yml
59
61
  has_rdoc: true
60
62
  homepage: http://github.com/kellymahan/RealTimeRails
61
63
  licenses: []