This project rocks and uses MIT-LICENSE.
Add the file chat.rb inside config/ Also define some variables: Chat.only_one_model = “true” # True if you want to use chat only for users, otherway put false and add ‘user_2_class’ Chat.user_1_class = “User” Chat.method_current_user = “current_user” Method used to get the current user, if your app has Devise, set the method to “current_#{your_model}”
rails g chat “chat” rake chat:install:migrations
routes.rb mount Chat::Engine => “/chat”
This gem requieres PushWoosh, you should create a service for that third party, called PushWooshService
PushWooshService.rb
class PushWooshService
def self.send_message(device_tokens, message) PushWoosh.delay.notify( send_date: 'now', ignore_user_timezone: true, content: message, platforms: [1], devices: [device_tokens] ) end def self.notify(notification) push = PushWoosher::Push.new(notification: notification) # We use pushwoosher gem to handle the comunication with PushWoosh API push.post end
end
Also chat gem requieres Pusher, you should create a service for that third party, called PusherService
Pusher.rb
class PusherService
def self.notify(chanel, event, message) Pusher.trigger("#{chanel}", "#{event}", message) end
end