This repository has been archived by the owner on Jul 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic setup of a cable connection example shell
- Loading branch information
0 parents
commit d73ce06
Showing
74 changed files
with
1,043 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore the default SQLite database. | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rails', github: "rails/rails" | ||
gem 'sprockets-rails', github: "rails/sprockets-rails" | ||
gem 'arel', github: "rails/arel" | ||
gem 'actioncable', github: "rails/actioncable" | ||
|
||
gem 'sqlite3' | ||
gem 'puma' | ||
|
||
gem 'sass-rails', '~> 5.0' | ||
gem 'uglifier', '>= 1.3.0' | ||
gem 'coffee-rails', github: "rails/coffee-rails" | ||
gem 'jquery-rails' | ||
gem 'turbolinks' | ||
|
||
gem 'jbuilder', '~> 2.0' | ||
|
||
group :development, :test do | ||
gem 'byebug' | ||
end | ||
|
||
group :development do | ||
gem 'web-console', github: 'rails/web-console' | ||
gem 'spring' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
GIT | ||
remote: git://github.com/rails/actioncable.git | ||
revision: cbc73069788abc62fca5cf33ae5a0a4f63937fb1 | ||
specs: | ||
actioncable (0.1.0) | ||
activesupport (>= 4.2.0) | ||
celluloid (~> 0.16.0) | ||
em-hiredis (~> 0.3.0) | ||
faye-websocket (~> 0.9.2) | ||
redis (~> 3.0) | ||
websocket-driver (= 0.5.4) | ||
|
||
GIT | ||
remote: git://github.com/rails/arel.git | ||
revision: 14df08d80fc363fb9932d9534503b3276d30d9a5 | ||
specs: | ||
arel (7.0.0.alpha) | ||
|
||
GIT | ||
remote: git://github.com/rails/coffee-rails.git | ||
revision: c05fb725613d96ce969c30a11e7b613e90f9e5e8 | ||
specs: | ||
coffee-rails (4.1.0) | ||
coffee-script (>= 2.2.0) | ||
railties (>= 4.0.0, < 5.0) | ||
|
||
GIT | ||
remote: git://github.com/rails/rails.git | ||
revision: c35c0c4a42b26978304613ddffd19c647e2bf5d1 | ||
specs: | ||
actionmailer (5.0.0.alpha) | ||
actionpack (= 5.0.0.alpha) | ||
actionview (= 5.0.0.alpha) | ||
activejob (= 5.0.0.alpha) | ||
mail (~> 2.5, >= 2.5.4) | ||
rails-dom-testing (~> 1.0, >= 1.0.5) | ||
actionpack (5.0.0.alpha) | ||
actionview (= 5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
rack (~> 1.6) | ||
rack-test (~> 0.6.3) | ||
rails-dom-testing (~> 1.0, >= 1.0.5) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.2) | ||
actionview (5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
builder (~> 3.1) | ||
erubis (~> 2.7.0) | ||
rails-dom-testing (~> 1.0, >= 1.0.5) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.2) | ||
activejob (5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
globalid (>= 0.3.0) | ||
activemodel (5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
builder (~> 3.1) | ||
activerecord (5.0.0.alpha) | ||
activemodel (= 5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
arel (= 7.0.0.alpha) | ||
activesupport (5.0.0.alpha) | ||
i18n (~> 0.7) | ||
json (~> 1.7, >= 1.7.7) | ||
minitest (~> 5.1) | ||
thread_safe (~> 0.3, >= 0.3.4) | ||
tzinfo (~> 1.1) | ||
rails (5.0.0.alpha) | ||
actionmailer (= 5.0.0.alpha) | ||
actionpack (= 5.0.0.alpha) | ||
actionview (= 5.0.0.alpha) | ||
activejob (= 5.0.0.alpha) | ||
activemodel (= 5.0.0.alpha) | ||
activerecord (= 5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
bundler (>= 1.3.0, < 2.0) | ||
railties (= 5.0.0.alpha) | ||
sprockets-rails | ||
railties (5.0.0.alpha) | ||
actionpack (= 5.0.0.alpha) | ||
activesupport (= 5.0.0.alpha) | ||
method_source | ||
rake (>= 0.8.7) | ||
thor (>= 0.18.1, < 2.0) | ||
|
||
GIT | ||
remote: git://github.com/rails/sprockets-rails.git | ||
revision: 34ae184693db41b4e3338940073af9d728881a9c | ||
specs: | ||
sprockets-rails (3.0.0.beta1) | ||
actionpack (>= 4.0) | ||
activesupport (>= 4.0) | ||
sprockets (>= 3.0.0, < 4.0) | ||
|
||
GIT | ||
remote: git://github.com/rails/web-console.git | ||
revision: baafb8e6d074c7b0532b6da6bfd6fe3be5e1549f | ||
specs: | ||
web-console (2.2.1) | ||
activemodel (>= 4.0) | ||
binding_of_caller (>= 0.7.2) | ||
railties (>= 4.0) | ||
sprockets-rails (>= 2.0, < 4.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
binding_of_caller (0.7.2) | ||
debug_inspector (>= 0.0.1) | ||
builder (3.2.2) | ||
byebug (5.0.0) | ||
columnize (= 0.9.0) | ||
celluloid (0.16.0) | ||
timers (~> 4.0.0) | ||
coffee-script (2.4.1) | ||
coffee-script-source | ||
execjs | ||
coffee-script-source (1.9.1.1) | ||
columnize (0.9.0) | ||
debug_inspector (0.0.2) | ||
em-hiredis (0.3.0) | ||
eventmachine (~> 1.0) | ||
hiredis (~> 0.5.0) | ||
erubis (2.7.0) | ||
eventmachine (1.0.7) | ||
execjs (2.5.2) | ||
faye-websocket (0.9.2) | ||
eventmachine (>= 0.12.0) | ||
websocket-driver (>= 0.5.1) | ||
globalid (0.3.5) | ||
activesupport (>= 4.1.0) | ||
hiredis (0.5.2) | ||
hitimes (1.2.2) | ||
i18n (0.7.0) | ||
jbuilder (2.3.1) | ||
activesupport (>= 3.0.0, < 5) | ||
multi_json (~> 1.2) | ||
jquery-rails (4.0.4) | ||
rails-dom-testing (~> 1.0) | ||
railties (>= 4.2.0) | ||
thor (>= 0.14, < 2.0) | ||
json (1.8.3) | ||
loofah (2.0.2) | ||
nokogiri (>= 1.5.9) | ||
mail (2.6.3) | ||
mime-types (>= 1.16, < 3) | ||
method_source (0.8.2) | ||
mime-types (2.6.1) | ||
mini_portile (0.6.2) | ||
minitest (5.7.0) | ||
multi_json (1.11.2) | ||
nokogiri (1.6.6.2) | ||
mini_portile (~> 0.6.0) | ||
puma (2.11.3) | ||
rack (>= 1.1, < 2.0) | ||
rack (1.6.4) | ||
rack-test (0.6.3) | ||
rack (>= 1.0) | ||
rails-deprecated_sanitizer (1.0.3) | ||
activesupport (>= 4.2.0.alpha) | ||
rails-dom-testing (1.0.6) | ||
activesupport (>= 4.2.0.beta, < 5.0) | ||
nokogiri (~> 1.6.0) | ||
rails-deprecated_sanitizer (>= 1.0.1) | ||
rails-html-sanitizer (1.0.2) | ||
loofah (~> 2.0) | ||
rake (10.4.2) | ||
redis (3.2.1) | ||
sass (3.4.16) | ||
sass-rails (5.0.3) | ||
railties (>= 4.0.0, < 5.0) | ||
sass (~> 3.1) | ||
sprockets (>= 2.8, < 4.0) | ||
sprockets-rails (>= 2.0, < 4.0) | ||
tilt (~> 1.1) | ||
spring (1.3.6) | ||
sprockets (3.2.0) | ||
rack (~> 1.0) | ||
sqlite3 (1.3.10) | ||
thor (0.19.1) | ||
thread_safe (0.3.5) | ||
tilt (1.4.1) | ||
timers (4.0.1) | ||
hitimes | ||
turbolinks (2.5.3) | ||
coffee-rails | ||
tzinfo (1.2.2) | ||
thread_safe (~> 0.1) | ||
uglifier (2.7.1) | ||
execjs (>= 0.3.0) | ||
json (>= 1.8.0) | ||
websocket-driver (0.5.4) | ||
websocket-extensions (>= 0.1.0) | ||
websocket-extensions (0.1.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
actioncable! | ||
arel! | ||
byebug | ||
coffee-rails! | ||
jbuilder (~> 2.0) | ||
jquery-rails | ||
puma | ||
rails! | ||
sass-rails (~> 5.0) | ||
spring | ||
sprockets-rails! | ||
sqlite3 | ||
turbolinks | ||
uglifier (>= 1.3.0) | ||
web-console! | ||
|
||
BUNDLED WITH | ||
1.10.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Action Cable Examples | ||
|
||
A collection of examples showcasing the capabilities of Action Cable. | ||
|
||
## Dependencies | ||
|
||
You must have redis installed and running on the default port (or configure it in config/redis/cable.yml). | ||
|
||
## Starting the servers | ||
|
||
1. Run ./bin/setup | ||
2. Run ./bin/cable | ||
3. Run ./bin/rails server | ||
4. Visit http://localhost:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require File.expand_path('../config/application', __FILE__) | ||
|
||
Rails.application.load_tasks |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. | ||
// | ||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | ||
// about supported directives. | ||
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require turbolinks | ||
//= require channels | ||
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#= require cable | ||
#= require_self | ||
#= require_tree . | ||
|
||
@App = {} | ||
App.cable = Cable.createConsumer 'ws://localhost:28080' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS | ||
* files in this directory. It is generally better to create a new file per style scope. | ||
* | ||
*= require_tree . | ||
*= require_self | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Examples controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Channel < ActionCable::Channel::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module ApplicationCable | ||
class Connection < ActionCable::Connection::Base | ||
identified_by :current_user | ||
|
||
def connect | ||
self.current_user = find_verified_user | ||
logger.add_tags current_user.name | ||
end | ||
|
||
protected | ||
def find_verified_user | ||
if current_user = User.first | ||
current_user | ||
else | ||
reject_unauthorized_connection | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ApplicationController < ActionController::Base | ||
# Prevent CSRF attacks by raising an exception. | ||
# For APIs, you may want to use :null_session instead. | ||
protect_from_forgery with: :exception | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ExamplesController < ApplicationController | ||
def index | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class ApplicationJob < ActiveJob::Base | ||
end |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class User < ActiveRecord::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<h1>Action Cable Examples</h1> | ||
|
||
<p> | ||
<ul> | ||
<li>Appearance</li> | ||
<li>Comments</li> | ||
</ul> | ||
</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Action Cable Examples</title> | ||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | ||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | ||
<%= csrf_meta_tags %> | ||
</head> | ||
<body> | ||
|
||
<%= yield %> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.
d73ce06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ ❤️ ❤️