Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No cramp and use celluloid workers to run callbacks
- Loading branch information
Showing
7 changed files
with
59 additions
and
16 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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
source 'http://rubygems.org' | ||
gemspec | ||
|
||
gem 'cramp', github: "lifo/cramp" | ||
|
||
group :test do | ||
gem 'rake' | ||
gem 'puma' | ||
|
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
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
require 'cramp' | ||
require 'active_support' | ||
require 'active_support/json' | ||
require 'active_support/concern' | ||
require 'active_support/core_ext/hash/indifferent_access' | ||
require 'active_support/callbacks' | ||
|
||
module ActionCable | ||
VERSION = '0.0.1' | ||
|
||
autoload :Channel, 'action_cable/channel' | ||
autoload :Worker, 'action_cable/worker' | ||
autoload :Server, 'action_cable/server' | ||
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
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
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 ActionCable | ||
class Worker | ||
include ActiveSupport::Callbacks | ||
include Celluloid | ||
|
||
define_callbacks :work | ||
|
||
def received_data(connection, data) | ||
run_callbacks :work do | ||
connection.received_data(data) | ||
end | ||
end | ||
|
||
def cleanup_subscriptions(connection) | ||
connection.cleanup_subscriptions | ||
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