RailsNotice
用于处理通告(Annunciation),消息(Notification);
- 只在用户请求数据时快速生成通知记录,避免僵尸用户产生的死数据;
Should set adapter as redis in development
development:
adapter: redis
url: redis://localhost:6379/1
<%= javascript_include_tag 'rails_notice/notice_channel', 'data-turbolinks-eval': 'false' %>
<%= stylesheet_link_tag 'rails_notice/cable' %>
<%= render 'notice_link' %>
# which model can receive notifications
class User < ApplicationRecord
include Notice::Ext::Receiver
end
class ApplicationController < ActionController::Base
include RailsNotice::Application
end
module ApplicationCable
class Connection < ActionCable::Connection::Base
prepend RailsNoticeConnection
end
end
遵循 MIT 协议