parent
10ba09f546
commit
6deb9f966e
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -0,0 +1,13 @@ |
|||||||
|
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||||
|
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
||||||
|
//
|
||||||
|
//= require action_cable
|
||||||
|
//= require_self
|
||||||
|
//= require_tree ./channels
|
||||||
|
|
||||||
|
(function() { |
||||||
|
this.App || (this.App = {}); |
||||||
|
|
||||||
|
App.cable = ActionCable.createConsumer(); |
||||||
|
|
||||||
|
}).call(this); |
@ -0,0 +1,13 @@ |
|||||||
|
App.timeline = App.cable.subscriptions.create("TimelineChannel", { |
||||||
|
connected: function() { |
||||||
|
console.log('Connected'); |
||||||
|
}, |
||||||
|
|
||||||
|
disconnected: function() { |
||||||
|
console.log('Disconnected'); |
||||||
|
}, |
||||||
|
|
||||||
|
received: function(data) { |
||||||
|
console.log(JSON.parse(data.message)); |
||||||
|
} |
||||||
|
}); |
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -1,5 +0,0 @@ |
|||||||
$ -> |
|
||||||
$(document).on 'turbolinks:load', -> |
|
||||||
unless typeof window.MiniProfiler == 'undefined' |
|
||||||
window.MiniProfiler.init() |
|
||||||
window.MiniProfiler.pageTransition() |
|
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -1,3 +0,0 @@ |
|||||||
# Place all the behaviors and hooks related to the matching controller here. |
|
||||||
# All this logic will automatically be available in application.js. |
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
|
@ -0,0 +1,5 @@ |
|||||||
|
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. |
||||||
|
module ApplicationCable |
||||||
|
class Channel < ActionCable::Channel::Base |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,20 @@ |
|||||||
|
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. |
||||||
|
module ApplicationCable |
||||||
|
class Connection < ActionCable::Connection::Base |
||||||
|
identified_by :current_user |
||||||
|
|
||||||
|
def connect |
||||||
|
self.current_user = find_verified_user |
||||||
|
end |
||||||
|
|
||||||
|
protected |
||||||
|
|
||||||
|
def find_verified_user |
||||||
|
if verified_user = env['warden'].user |
||||||
|
verified_user |
||||||
|
else |
||||||
|
reject_unauthorized_connection |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,10 @@ |
|||||||
|
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. |
||||||
|
class TimelineChannel < ApplicationCable::Channel |
||||||
|
def subscribed |
||||||
|
stream_from "timeline:#{current_user.id}" |
||||||
|
end |
||||||
|
|
||||||
|
def unsubscribed |
||||||
|
# Any cleanup needed when channel is unsubscribed |
||||||
|
end |
||||||
|
end |
@ -1,6 +1,2 @@ |
|||||||
require 'rack-mini-profiler' |
Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler) |
||||||
|
Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater) |
||||||
Rack::MiniProfilerRails.initialize!(Rails.application) |
|
||||||
|
|
||||||
Rails.application.middleware.delete(Rack::MiniProfiler) |
|
||||||
Rails.application.middleware.insert_after(Rack::Deflater, Rack::MiniProfiler) |
|
||||||
|
Loading…
Reference in new issue