diff --git a/app/assets/javascripts/realtime.js.coffee b/app/assets/javascripts/realtime.js.coffee index 9efcd6b1..8fa52024 100644 --- a/app/assets/javascripts/realtime.js.coffee +++ b/app/assets/javascripts/realtime.js.coffee @@ -1,6 +1,6 @@ window.app.realtime = connect : () -> - #window.app.socket = io.connect('http://localhost:5001'); - #window.app.socket.on 'connect', () -> - #subscribeToRooms() - #console.log('socket connected') \ No newline at end of file + window.app.socket = io.connect('http://gentle-savannah-1303.herokuapp.com:5001'); + window.app.socket.on 'connect', () -> + subscribeToRooms() + console.log('socket connected') \ No newline at end of file diff --git a/app/controllers/mappings_controller.rb b/app/controllers/mappings_controller.rb index e65dcdfa..b0a5f03c 100644 --- a/app/controllers/mappings_controller.rb +++ b/app/controllers/mappings_controller.rb @@ -44,7 +44,7 @@ class MappingsController < ApplicationController @mapping.save() #push add to map to realtime viewers of the map - #@mapping.message 'create',@user.id + @mapping.message 'create',@user.id end end diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index ecf79626..69350057 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -183,7 +183,7 @@ class MapsController < ApplicationController @mapping.save #push realtime update for location on map - #@mapping.message 'update',@user.id + @mapping.message 'update',@user.id end end @map.arranged = true diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index 6c99bfc9..37102afb 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -101,7 +101,7 @@ class SynapsesController < ApplicationController @mapping.save #push add to map to realtime viewers of the map - #@mapping.message 'create',@user.id + @mapping.message 'create',@user.id # set the permission of the synapse to whatever the permission of the #map is @@ -156,11 +156,11 @@ class SynapsesController < ApplicationController #push notify to anyone viewing this synapse on a map in realtime (see mapping.rb to understand the 'message' action) # if the topic was private and is being switched to PU or CO it is the same as being created for other viewers if @permissionBefore == "private" and @permissionAfter != "private" - #@synapse.message 'create',@current.id + @synapse.message 'create',@current.id elsif @permissionBefore != "private" and @permissionAfter == "private" - #@synapse.message 'destroy',@current.id + @synapse.message 'destroy',@current.id else - #@synapse.message 'update',@current.id + @synapse.message 'update',@current.id end end @@ -177,7 +177,7 @@ class SynapsesController < ApplicationController @mapping = Mapping.find_by_synapse_id_and_map_id(params[:synapse_id],params[:map_id]) #push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action) - #@mapping.message 'destroy',@user.id + @mapping.message 'destroy',@user.id @mapping.delete @@ -193,7 +193,7 @@ class SynapsesController < ApplicationController @synapse.mappings.each do |m| #push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action) - #m.message 'destroy',@current.id + m.message 'destroy',@current.id m.delete end diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 0a5d0ea4..f3cb46c6 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -127,7 +127,7 @@ class TopicsController < ApplicationController @mapping.save #push add to map to realtime viewers of the map - #@mapping.message 'create',@user.id + @mapping.message 'create',@user.id end respond_to do |format| @@ -170,11 +170,11 @@ class TopicsController < ApplicationController #push notify to anyone viewing this topic on a map in realtime (see mapping.rb to understand the 'message' action) # if the topic was private and is being switched to PU or CO it is the same as being created for other viewers if @permissionBefore == "private" and @permissionAfter != "private" - #@topic.message 'create',@current.id + @topic.message 'create',@current.id elsif @permissionBefore != "private" and @permissionAfter == "private" - #@topic.message 'destroy',@current.id + @topic.message 'destroy',@current.id else - #@topic.message 'update',@current.id + @topic.message 'update',@current.id end end @@ -198,7 +198,7 @@ class TopicsController < ApplicationController @mappings.each do |m| #push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action) - #m.message 'destroy',@current.id + m.message 'destroy',@current.id m.delete end @@ -226,7 +226,7 @@ class TopicsController < ApplicationController @synapses.each do |synapse| synapse.mappings.each do |m| #push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action) - #m.message 'destroy',@current.id + m.message 'destroy',@current.id m.delete end @@ -236,7 +236,7 @@ class TopicsController < ApplicationController @mappings.each do |mapping| #push notify to anyone viewing a map with this topic in realtime (see mapping.rb to understand the 'message' action) - #mapping.message 'destroy',@current.id + mapping.message 'destroy',@current.id mapping.delete end diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb index ed4b92e0..edc3f2f2 100644 --- a/config/initializers/redis.rb +++ b/config/initializers/redis.rb @@ -1 +1,6 @@ -$redis = Redis.new(:host => 'localhost', :port=> 6379) \ No newline at end of file +if Rails.env.development? + $redis = Redis.new(:host => 'localhost', :port=> 6379) +elsif Rails.env.production? + uri = URI.parse(ENV["REDISTOGO_URL"]) + $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) +end \ No newline at end of file