Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Chat Implementation with RESTful (Ruby) and Web Socket

Chat Implementation with RESTful (Ruby) and Web Socket

Slides for talk at Saigon.rb March 2016

Cam Huynh

March 01, 2016
Tweet

More Decks by Cam Huynh

Other Decks in Technology

Transcript

  1. What this talk is about? • What we experienced during

    the development of Dadadee chat system. • Technologies we’ve considered during the development. • Problems we faced and how we solved them.
  2. Functionality Requirement • Integrate realtime chat function to our existing

    Android and iOS app. • Web services built upon Ruby on Rails.
  3. Our Back-end Resources • Two Plain Old Ruby Developers. •

    Our application built upon Ruby on Rails. • Limited NodeJS experience.
  4. Technology taken into considerations • XMPP. • Pure NodeJS with

    Socket.IO • Long polling (Message Bus) in Ruby.
  5. Socket.IO Pros: • Rich documentations and guides. • Easy to

    start off, fast development. • Support both of Android and iOS (by native JS executor). • 23k stars on Github. Cons: • Rewrite the domain logics in Javascript. • Lack of experience in Javascript. • Callback Hell. > Manage logics in Javascript is the most horrible thing Rubyists could think of.
  6. Message Bus Pros: * Extracted from Discourse, by Sam Saffron.

    * Written in Ruby. * Awesome DSL. Cons: * Have no SDKs for Android and iOS yet, and our mobile guys have ZERO experience in Javascript. * Only polling and long polling, no websocket support. * Leverage on Redis PUBSUB, no other backend supported.
  7. Pros • Simple installation. • Robust, well-tested. • Mature and

    widely adopted. • iOS and Android clients are available. > We decided to give OpenFire a try. OpenFire (XMPP) Cons • We have zero Java experience • Bad, complicated management user interface. • Bad message history archives. • Poor RESTful (so-called) API. • Troublesome clustering. • Inactive development. > The failure of the year.
  8. we are stuck! SocketIO / MessageBus: too tedious and risky.

    OpenFire (XMPP): the failure of the year.