Giter Club home page Giter Club logo

chat's Introduction

Chat

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.