diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2015-02-05 16:35:11 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2015-02-05 16:35:11 +0530 |
commit | 7fef6b01a3011438d48136e3f95bb9a823e87ec6 (patch) | |
tree | 2b74ab63e910382a31eef582598445853059a28c /lib/action_cable/worker.rb | |
parent | 55c956b346dfb26a0ac5a5686f4be7f96b28cff6 (diff) | |
download | rails-7fef6b01a3011438d48136e3f95bb9a823e87ec6.tar.gz rails-7fef6b01a3011438d48136e3f95bb9a823e87ec6.tar.bz2 rails-7fef6b01a3011438d48136e3f95bb9a823e87ec6.zip |
No cramp and use celluloid workers to run callbacks
Diffstat (limited to 'lib/action_cable/worker.rb')
-rw-r--r-- | lib/action_cable/worker.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/action_cable/worker.rb b/lib/action_cable/worker.rb new file mode 100644 index 0000000000..46b5f7edc0 --- /dev/null +++ b/lib/action_cable/worker.rb @@ -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 |