SlideShare a Scribd company logo
1 of 39
Download to read offline
Microblogging with XMPP
        Real Time Web
Who am I?

• Name: Stoyan Zhekov
• Private: married, 3 kids (boys)
• Work: Software Engineer
• Contact: xmpp: //zh@jabber.jp
Today

• XMPP (Jabber)
• Microblogging
• Microblogging with XMPP
• My program - xmpp4r, ramaze, sequel
• Questions
Why?

• Web 3.0 ? - Real Time Web?
• RSS is not enough (SUP)
• XMPP (Jabber)
• Webhooks
XMPP (Jabber)
London-Calcutta, message + reply
              (Peter Saint-Andre)


• 1800:   2 years (ship)
• 1914:   1 month (steamship)
• 1950:   1 week (airmail)
• 1980:   2 days (overnight mail)
• 1994:   10 min (email)
• 1999:   1 sec (IM)
XMPP (history)

• 1998: Jeremie Miller - ICQ - AIM (perl)
• 1999: First rellease
• 2001: Jabber Software Fondation
• 2004: XMPP RFCs (IETF)
What is XMPP?

• JID: node@server/Resource
• Open Protocol
• Decentralized - no central server
• RFC 3290 (core), 3291 (messaging)
• XMPP extension protocols (XEP)
What is XMPP? (2)
• Bidirectional, streaming XML
• One first level tag: <stream>
• 3 second level tags:
   • <presence> - presence, subscribtion
   • <message> - asynchronous
   • <iq> - synchronous
XMPP Features

• Build-in presence
• One-to-one IM (u2u, a2u, a2a)
• Groupchat
• Geolocation
• Security - SSL, TLS
Not only for geeks

• 50 000+ servers, 50+ million users
• Wall Street
• US Department of Defense
• Cisco, Google, Apple
• NTT ?
You on XMPP

• Free account - jabber.jp etc.
• GTalk for domains
• Install your own server:
    • ejabberd (erlang) - production
    • openfire (java) - easy to install / use
Libraries

• For a lot of OSes and languages
• loudmouth (C)
• xiff (flash)
• smack (java)
• xmpp4r (ruby)
Microblogging
Microblogging

• Web 2.0
• What is it?
   • Status changes
   • Short notes (140 limit)
   • Media files
Big players

• Twitter
• Jaiku
• identi.ca (laconi.ca) - OSS
• Tumblr - http://tt.zhekov.net/
• FriendFeed, Lifestream.fm
Microblogging with XMPP
   http://www.microblog.org/
Almost Real Time

• XMPP bots (Jaiku, Identi.ca, FriendFeed)
• GNIP - http://www.gnipcentral.com/
• RSS-to-XMPP
   • http://notify.me/
   • http://notifixio.us/ (WP plugin)
Microblogging with XMPP

• Web 3.0 (Real Time Web)
• PubSub - XEP-0060
• BOSH - XEP-0124
• XEP-XXXX
• ....
Too complicated :(
Am I stupid...? :(
My own program
Design

• XMPP bot
• Simple API
• Simple web frontend
• Models: juick.com , kwippy.com
Components

• models.rb - connection to the DB
• bot.rb - XMPP
• api.rb - service, scaling
• web.rb - browser view
Models
• “Things”
   • User
   • Micro
• “Relations”
   • Subscribe - User-to-User
   • Subscribe - User-to-Micro
   • Like - User-to-Micro
Relations (Sequel)
class User < Sequel::Model(:users)
 one_to_many :micros do |ds|
  ds.filter(:parent_id => nil)
 end
 one_to_many :subs,
              :extend => UserFindOrCreate
 many_to_many :publishers,
              :class => :User, :join_table => :subs
end
Ruby XMPP Libraries

• xmpp4r - Roster, vCard etc.
• xmpp4r-simple - easy to use
• jabber4r - Thread based :(
XMPP Bot

• http://tr.im/emxmpp (nutrun.com)
• EventMachine - libevent, Deferrable
• Plugins - http://tr.im/modular
Concurrency
EM.run do
 EM::PeriodicTimer.new(1) do
  ...
      EM.spawn do
       worker = Worker.new
       worker.callback {jabber.deliver(message.from,
quot;Donequot;)}
       worker.process
      end.notify
  ...
 end
end

class Worker
  include EM::Deferrable

 def process
  ...
  set_deferred_status :succeeded
 end
end
Plugins 1/3
PluginFactory.load quot;pluginsquot;
...
def PluginFactory.load( dirname )
    Dir.open( dirname ).each do |fn|
      next unless ( fn =~ /[.]rb$/ )
      require quot;#{dirname}/#{fn}quot;
    end
end
Plugins 2/3
class Plugin
   include EM::Deferrable

  def process( args = {} )
    sleep(0.05)
    set_deferred_status :succeeded
  end
end
Plugins 3/3
class NickPlugin < Plugin
  def process(args = {})
   begin
     ...
     set_deferred_status :succeeded
   rescue
     set_deferred_status :failed
   end
  end
end

class NickFactory < PluginFactory
INFO=<<INFO
verb: NICK
author: Stoyan Zhekov
description: Get or set the nickname for some user
INFO
  def create()
   return NickPlugin.new()
  end
end
Simple API (json)

• /users - list of users
• /user/<nick>/<secret> - info for user
• /status/<nick>/<secret> - presence
• /micros/<page>/<format> - list of micros
• /micro/<id>/<secret> - micro + comments
Web (Ramaze)
class MainController < Ramaze::Controller
  def u nick
   begin
     @user = User.find_by_user(nick)
     subset = @user.micros.reverse
     @micros, @pager = paginate(subset, :limit => PAGE)
   rescue Exception => e
     flash[:error] = quot;Error: #{e.to_s}quot;
     redirect :/, :status => 302
   end
  end
end
<Demo>
To Do

• Commands parser - Ragel?
• OAuth or http://xmppid.net/
• TokyoCabinet
• XMPP Component -    http://github.com/julien51/babylon


• Real PubSub?
Conclusion

• XMPP - good, open protocol
• xmpp4r-simple - good, easy to use
• eventmachine - good network library
• sequel - good ORM
• ramaze - good web apps framework
Questions?
</stream:stream>

More Related Content

Similar to Microblogging via XMPP

Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
Web Development: The Next Five Years
Web Development: The Next Five YearsWeb Development: The Next Five Years
Web Development: The Next Five Yearssneeu
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorialoscon2007
 
Scaling Twitter 12758
Scaling Twitter 12758Scaling Twitter 12758
Scaling Twitter 12758davidblum
 
Scaling Twitter
Scaling TwitterScaling Twitter
Scaling TwitterBlaine
 
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPPFast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPPPradeep Elankumaran
 
Rails hosting
Rails hostingRails hosting
Rails hostingwonko
 
Streaming huge databases using logical decoding
Streaming huge databases using logical decodingStreaming huge databases using logical decoding
Streaming huge databases using logical decodingAlexander Shulgin
 
Messaging With Erlang And Jabber
Messaging With  Erlang And  JabberMessaging With  Erlang And  Jabber
Messaging With Erlang And Jabberl xf
 
SAPO Messenger
SAPO MessengerSAPO Messenger
SAPO Messengercodebits
 
Criando um Instant Messenger
Criando um Instant MessengerCriando um Instant Messenger
Criando um Instant Messengervinibaggio
 
OSDC 2016 - Ingesting Logs with Style by Pere Urbon-Bayes
OSDC 2016 - Ingesting Logs with Style by Pere Urbon-BayesOSDC 2016 - Ingesting Logs with Style by Pere Urbon-Bayes
OSDC 2016 - Ingesting Logs with Style by Pere Urbon-BayesNETWAYS
 
Symfony 2.0
Symfony 2.0Symfony 2.0
Symfony 2.0GrUSP
 
Comet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyComet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyBrian Moschel
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2Merixstudio
 

Similar to Microblogging via XMPP (20)

Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
XMPP - Beyond IM
XMPP - Beyond IMXMPP - Beyond IM
XMPP - Beyond IM
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Web Development: The Next Five Years
Web Development: The Next Five YearsWeb Development: The Next Five Years
Web Development: The Next Five Years
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Scaling Twitter 12758
Scaling Twitter 12758Scaling Twitter 12758
Scaling Twitter 12758
 
Scaling Twitter
Scaling TwitterScaling Twitter
Scaling Twitter
 
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPPFast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP
 
Rails hosting
Rails hostingRails hosting
Rails hosting
 
Kommons
KommonsKommons
Kommons
 
Streaming huge databases using logical decoding
Streaming huge databases using logical decodingStreaming huge databases using logical decoding
Streaming huge databases using logical decoding
 
Messaging With Erlang And Jabber
Messaging With  Erlang And  JabberMessaging With  Erlang And  Jabber
Messaging With Erlang And Jabber
 
SAPO Messenger
SAPO MessengerSAPO Messenger
SAPO Messenger
 
Criando um Instant Messenger
Criando um Instant MessengerCriando um Instant Messenger
Criando um Instant Messenger
 
Blogopolisの裏側
Blogopolisの裏側Blogopolisの裏側
Blogopolisの裏側
 
OSDC 2016 - Ingesting Logs with Style by Pere Urbon-Bayes
OSDC 2016 - Ingesting Logs with Style by Pere Urbon-BayesOSDC 2016 - Ingesting Logs with Style by Pere Urbon-Bayes
OSDC 2016 - Ingesting Logs with Style by Pere Urbon-Bayes
 
The Art of Grey-Box Attack
The Art of Grey-Box AttackThe Art of Grey-Box Attack
The Art of Grey-Box Attack
 
Symfony 2.0
Symfony 2.0Symfony 2.0
Symfony 2.0
 
Comet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called JabbifyComet: an Overview and a New Solution Called Jabbify
Comet: an Overview and a New Solution Called Jabbify
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
 

More from Stoyan Zhekov

Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraStoyan Zhekov
 
Deployment on Heroku
Deployment on HerokuDeployment on Heroku
Deployment on HerokuStoyan Zhekov
 
Push the web with HTML5
Push the web with HTML5Push the web with HTML5
Push the web with HTML5Stoyan Zhekov
 
Foreman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple componentsForeman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple componentsStoyan Zhekov
 
Social Network for spare parts
Social Network for spare partsSocial Network for spare parts
Social Network for spare partsStoyan Zhekov
 
Using XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking informationUsing XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking informationStoyan Zhekov
 
Websockets with ruby
Websockets with rubyWebsockets with ruby
Websockets with rubyStoyan Zhekov
 
Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)Stoyan Zhekov
 
Webhooks - glue for the web
Webhooks - glue for the webWebhooks - glue for the web
Webhooks - glue for the webStoyan Zhekov
 
Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)Stoyan Zhekov
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)Stoyan Zhekov
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)Stoyan Zhekov
 
Rails Deployment with NginX
Rails Deployment with NginXRails Deployment with NginX
Rails Deployment with NginXStoyan Zhekov
 

More from Stoyan Zhekov (18)

Multirotors
MultirotorsMultirotors
Multirotors
 
ZeroMQ
ZeroMQZeroMQ
ZeroMQ
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
Sequel
SequelSequel
Sequel
 
Deployment on Heroku
Deployment on HerokuDeployment on Heroku
Deployment on Heroku
 
Push the web with HTML5
Push the web with HTML5Push the web with HTML5
Push the web with HTML5
 
Foreman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple componentsForeman - Process manager for applications with multiple components
Foreman - Process manager for applications with multiple components
 
Social Network for spare parts
Social Network for spare partsSocial Network for spare parts
Social Network for spare parts
 
Using XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking informationUsing XMPP Presence stanzas for real-time parking information
Using XMPP Presence stanzas for real-time parking information
 
Ruby cooking
Ruby cookingRuby cooking
Ruby cooking
 
Websockets with ruby
Websockets with rubyWebsockets with ruby
Websockets with ruby
 
EventMachine
EventMachineEventMachine
EventMachine
 
Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)Webhooks - glue for the web (japanese)
Webhooks - glue for the web (japanese)
 
Webhooks - glue for the web
Webhooks - glue for the webWebhooks - glue for the web
Webhooks - glue for the web
 
Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)Microblogging via XMPP (japanese)
Microblogging via XMPP (japanese)
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)
 
Rails Deployment with NginX
Rails Deployment with NginXRails Deployment with NginX
Rails Deployment with NginX
 

Recently uploaded

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Recently uploaded (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

Microblogging via XMPP

  • 1. Microblogging with XMPP Real Time Web
  • 2. Who am I? • Name: Stoyan Zhekov • Private: married, 3 kids (boys) • Work: Software Engineer • Contact: xmpp: //zh@jabber.jp
  • 3. Today • XMPP (Jabber) • Microblogging • Microblogging with XMPP • My program - xmpp4r, ramaze, sequel • Questions
  • 4. Why? • Web 3.0 ? - Real Time Web? • RSS is not enough (SUP) • XMPP (Jabber) • Webhooks
  • 6. London-Calcutta, message + reply (Peter Saint-Andre) • 1800: 2 years (ship) • 1914: 1 month (steamship) • 1950: 1 week (airmail) • 1980: 2 days (overnight mail) • 1994: 10 min (email) • 1999: 1 sec (IM)
  • 7. XMPP (history) • 1998: Jeremie Miller - ICQ - AIM (perl) • 1999: First rellease • 2001: Jabber Software Fondation • 2004: XMPP RFCs (IETF)
  • 8. What is XMPP? • JID: node@server/Resource • Open Protocol • Decentralized - no central server • RFC 3290 (core), 3291 (messaging) • XMPP extension protocols (XEP)
  • 9. What is XMPP? (2) • Bidirectional, streaming XML • One first level tag: <stream> • 3 second level tags: • <presence> - presence, subscribtion • <message> - asynchronous • <iq> - synchronous
  • 10. XMPP Features • Build-in presence • One-to-one IM (u2u, a2u, a2a) • Groupchat • Geolocation • Security - SSL, TLS
  • 11. Not only for geeks • 50 000+ servers, 50+ million users • Wall Street • US Department of Defense • Cisco, Google, Apple • NTT ?
  • 12. You on XMPP • Free account - jabber.jp etc. • GTalk for domains • Install your own server: • ejabberd (erlang) - production • openfire (java) - easy to install / use
  • 13. Libraries • For a lot of OSes and languages • loudmouth (C) • xiff (flash) • smack (java) • xmpp4r (ruby)
  • 15. Microblogging • Web 2.0 • What is it? • Status changes • Short notes (140 limit) • Media files
  • 16. Big players • Twitter • Jaiku • identi.ca (laconi.ca) - OSS • Tumblr - http://tt.zhekov.net/ • FriendFeed, Lifestream.fm
  • 17. Microblogging with XMPP http://www.microblog.org/
  • 18. Almost Real Time • XMPP bots (Jaiku, Identi.ca, FriendFeed) • GNIP - http://www.gnipcentral.com/ • RSS-to-XMPP • http://notify.me/ • http://notifixio.us/ (WP plugin)
  • 19. Microblogging with XMPP • Web 3.0 (Real Time Web) • PubSub - XEP-0060 • BOSH - XEP-0124 • XEP-XXXX • ....
  • 23. Design • XMPP bot • Simple API • Simple web frontend • Models: juick.com , kwippy.com
  • 24. Components • models.rb - connection to the DB • bot.rb - XMPP • api.rb - service, scaling • web.rb - browser view
  • 25. Models • “Things” • User • Micro • “Relations” • Subscribe - User-to-User • Subscribe - User-to-Micro • Like - User-to-Micro
  • 26. Relations (Sequel) class User < Sequel::Model(:users) one_to_many :micros do |ds| ds.filter(:parent_id => nil) end one_to_many :subs, :extend => UserFindOrCreate many_to_many :publishers, :class => :User, :join_table => :subs end
  • 27. Ruby XMPP Libraries • xmpp4r - Roster, vCard etc. • xmpp4r-simple - easy to use • jabber4r - Thread based :(
  • 28. XMPP Bot • http://tr.im/emxmpp (nutrun.com) • EventMachine - libevent, Deferrable • Plugins - http://tr.im/modular
  • 29. Concurrency EM.run do EM::PeriodicTimer.new(1) do ... EM.spawn do worker = Worker.new worker.callback {jabber.deliver(message.from, quot;Donequot;)} worker.process end.notify ... end end class Worker include EM::Deferrable def process ... set_deferred_status :succeeded end end
  • 30. Plugins 1/3 PluginFactory.load quot;pluginsquot; ... def PluginFactory.load( dirname ) Dir.open( dirname ).each do |fn| next unless ( fn =~ /[.]rb$/ ) require quot;#{dirname}/#{fn}quot; end end
  • 31. Plugins 2/3 class Plugin include EM::Deferrable def process( args = {} ) sleep(0.05) set_deferred_status :succeeded end end
  • 32. Plugins 3/3 class NickPlugin < Plugin def process(args = {}) begin ... set_deferred_status :succeeded rescue set_deferred_status :failed end end end class NickFactory < PluginFactory INFO=<<INFO verb: NICK author: Stoyan Zhekov description: Get or set the nickname for some user INFO def create() return NickPlugin.new() end end
  • 33. Simple API (json) • /users - list of users • /user/<nick>/<secret> - info for user • /status/<nick>/<secret> - presence • /micros/<page>/<format> - list of micros • /micro/<id>/<secret> - micro + comments
  • 34. Web (Ramaze) class MainController < Ramaze::Controller def u nick begin @user = User.find_by_user(nick) subset = @user.micros.reverse @micros, @pager = paginate(subset, :limit => PAGE) rescue Exception => e flash[:error] = quot;Error: #{e.to_s}quot; redirect :/, :status => 302 end end end
  • 36. To Do • Commands parser - Ragel? • OAuth or http://xmppid.net/ • TokyoCabinet • XMPP Component - http://github.com/julien51/babylon • Real PubSub?
  • 37. Conclusion • XMPP - good, open protocol • xmpp4r-simple - good, easy to use • eventmachine - good network library • sequel - good ORM • ramaze - good web apps framework