Git Product home page Git Product logo

symple-client-ruby's Introduction

Symple Ruby Client

The Symple client module for Ruby which enables one to send Symple messages from a Ruby app to the server using the intermediary redis instance.

What is Symple?

Symple is a presence and messaging protocol which is semantically similar to XMPP, except that it is unrestrictive and vastly simplified, and it uses JSON instead of XML for encoding messages. Symple also has a C++ client which makes it ideas for messaging and remoting between desktop, mobile and browser clients.

How to use it

  1. Clone the symple-ruby-client
  2. Simply require the symple.rb file in your Ruby app
  3. Call broadcast, broadcast_user or broadcast_group to send a JSON serialized object to peers.

Examples

Here is an example of using Symple in a Rails app. Lets say we have an Event model, and we want to broadcast the object to all connected peers in the group when a new Event is created:

class Event < ActiveRecord::Base
  belongs_to :user      
  after_create :symple_broadcast
  
  def symple_broadcast
    Symple.broadcast_group(self.user.group_id, {
        name: self.name,                                     # name of the event
        type: self.class.name,                               # the name of the object being serialized
        from: "#{self.user.username}@#{self.user.group_id}", # sender symple address
        data: self                                           # pass the instance to be serialized using to_json
      })
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contact

For more information please check out the Symple homepage: http://sourcey.com/symple/
If you have a bug or an issue then please use our new Github issue tracker: https://github.com/sourcey/symple-client-ruby/issues

symple-client-ruby's People

Contributors

auscaster avatar

Watchers

 avatar  avatar

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.