SlideShare a Scribd company logo
Socket applications
João Moura
João Moura
     @joaomdmoura
    joaomdmoura.com
github.com/joaomdmoura
Socket applications
Socket applications
Socket applications
Socket applications
Socket Applications
What?
What?
Examples
What?
Examples
Chat, a Livestream of feed, Games or even public
APIs
What?
Examples
Chat, a Livestream of feed, Games or even public
APIs

Usual Solution
What?
Examples
Chat, a Livestream of feed, Games or even public
APIs

Usual Solution
Ajax requests in regular times to an server
( Pooling )
What?
Examples
Chat, a Livestream of feed, Games or even public
APIs

Usual Solution
Ajax requests in regular times to an server
( Pooling )
Socket applications
Socket applications
Problems
Problems
- Don’t support multiples simultaneously
connections.
Problems
- Don’t support multiples simultaneously
connections.

- Synchronous I/O, the real problem, if the server
are saving an archive or doing a query in database
this process have to wait before continue.
Solution
Solution
Multi-thread model with an asynchronous I/O
Solution
Multi-thread model with an asynchronous I/O


Reactor Pattern
Solution
Multi-thread model with an asynchronous I/O


Reactor Pattern
Instead of waiting on a response from network, use
that time to process another request.
Socket applications
An constant, bi-directional and
asynchronous communication flow
Socket applications
Socket applications
Socket applications
Action
Action
Request


Action
Request


Action             Process
Request


Action             Process
Request

          Pack
Action             Process
Socket applications
Socket applications
Socket applications
Socket applications
Socket Connection
Socket Connection


Action
Socket Connection
          Request / Pack
Action
Socket Connection
          Request / Pack
Action                       Process
Socket Connection
          Request / Pack
Action                       Process
Why?
Why?
   The deal is not about being connected
anymore, it’s about doing it faster, better and
                  different
Socket applications
- Amazon: 100 ms of extra load time caused a 1%
drop in sales (source: Greg Linden, Amazon).
- Amazon: 100 ms of extra load time caused a 1%
drop in sales (source: Greg Linden, Amazon).

- Google: 500 ms of extra load time caused 20%
fewer searches (source: Marrissa Mayer, Google).
- Amazon: 100 ms of extra load time caused a 1%
drop in sales (source: Greg Linden, Amazon).

- Google: 500 ms of extra load time caused 20%
fewer searches (source: Marrissa Mayer, Google).

- Yahoo!: 400 ms of extra load time caused a 5–9%
increase in the number of people who clicked
“back” before the page even loaded (source: Nicole
Sullivan, Yahoo!).
It contribute to SPA concept and increases
the performance and the UX.

Example
http://www.toyota.com/itsacar/
IMPORTANT!
IMPORTANT!
THERE IS NO SILVER
     BULLET!
How?
How?
It’s up to you!
How?
It’s up to you!
Tools ( gems, frameworks, external services )
Tools ( gems, frameworks, external services )

- Pusher
- Socket.IO
- EventMachine
- Cramp
Tools ( gems, frameworks, external services )

- Pusher             - Juggernaut
- Socket.IO          - ØMQ
- EventMachine       - Einhorn
- Cramp              - SocketStream
Redis
Redis
“Redis is an open source, advanced key-value store.
It is often referred to as a data structure server
since keys can contain strings, hashes, lists, sets and
sorted sets.”
Socket applications
Socket applications
Show me the code!
Code!
Code!
Cause I love Ruby and Javascript!
Code!
        Cause I love Ruby and Javascript!

Rails ( Ruby )
Code!
         Cause I love Ruby and Javascript!

Rails ( Ruby )
Juggernaut gem - https://github.com/maccman/juggernaut
Code!
         Cause I love Ruby and Javascript!

Rails ( Ruby )
Juggernaut gem - https://github.com/maccman/juggernaut


Node.js ( Javascript )
Code!
          Cause I love Ruby and Javascript!

Rails ( Ruby )
Juggernaut gem - https://github.com/maccman/juggernaut


Node.js ( Javascript )
SocketStream framework - https://github.com/
socketstream/socketstream
WAT!
WAT!
Socket applications
~$ irb
>> aNameError: undefined local variable or method `a' for
main:Object!   from (irb):1! from /Users/joaomdmoura/.rvm/rubies/
ruby-1.9.2-p290/bin/irb:16:in `<main>'
>> a = bNameError: undefined local variable or method `b' for
main:Object!   from (irb):2! from /Users/joaomdmoura/.rvm/rubies/
ruby-1.9.2-p290/bin/irb:16:in `<main>'
~$ irb
>> aNameError: undefined local variable or method `a' for
main:Object!   from (irb):1! from /Users/joaomdmoura/.rvm/rubies/
ruby-1.9.2-p290/bin/irb:16:in `<main>'
>> a = bNameError: undefined local variable or method `b' for
main:Object!   from (irb):2! from /Users/joaomdmoura/.rvm/rubies/
ruby-1.9.2-p290/bin/irb:16:in `<main>'




>> a = a => nil
~$ irb
>> aNameError: undefined local variable or method `a' for
main:Object!   from (irb):1! from /Users/joaomdmoura/.rvm/rubies/
ruby-1.9.2-p290/bin/irb:16:in `<main>'
>> a = bNameError: undefined local variable or method `b' for
main:Object!   from (irb):2! from /Users/joaomdmoura/.rvm/rubies/
ruby-1.9.2-p290/bin/irb:16:in `<main>'




>> a = a => nil
Socket applications
~$ jsc> [] + []> [] +
{}[object Object]> {}
+ []0> {} + {}NaN
~$ jsc> [] + []> [] +
{}[object Object]> {}
+ []0> {} + {}NaN
Socket applications
Socket applications
~$ jsc
~$ jsc
> Array(16),,,,,,,,,,,,,,,
~$ jsc
> Array(16),,,,,,,,,,,,,,,

>
Array(16).join("wat")watwatwatwatwatwatwatwatwatwatwatwatwatwa
twat
~$ jsc
> Array(16),,,,,,,,,,,,,,,

>
Array(16).join("wat")watwatwatwatwatwatwatwatwatwatwatwatwatwa
twat

> Array(16).join("wat" +
1)wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1
~$ jsc
> Array(16),,,,,,,,,,,,,,,

>
Array(16).join("wat")watwatwatwatwatwatwatwatwatwatwatwatwatwa
twat

> Array(16).join("wat" +
1)wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1

> Array(16).join("wat" - 1) + "
Batman!"NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!
~$ jsc
> Array(16),,,,,,,,,,,,,,,

>
Array(16).join("wat")watwatwatwatwatwatwatwatwatwatwatwatwatwa
twat

> Array(16).join("wat" +
1)wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1wat1

> Array(16).join("wat" - 1) + "
Batman!"NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!
RoR w/ Juggernaut
RoR w/ Juggernaut

- Application Scaffold
RoR w/ Juggernaut

- Application Scaffold
- Juggernaut Installation
RoR w/ Juggernaut

- Application Scaffold
- Juggernaut Installation
- Dependencies:
RoR w/ Juggernaut

- Application Scaffold
- Juggernaut Installation
- Dependencies:
- Redis
RoR w/ Juggernaut

- Application Scaffold
- Juggernaut Installation
- Dependencies:
- Redis
- Node.js
RoR w/ Juggernaut

- Application Scaffold
- Juggernaut Installation
- Dependencies:
- Redis
- Node.js
- NPM ( Node Package Manager )
RoR w/ Juggernaut

- Application Scaffold
- Juggernaut Installation
- Dependencies:
- Redis
- Node.js
- NPM ( Node Package Manager )


       npm install -g juggernaut
        gem install juggernaut
> redis-server
 > juggernaut
  http://localhost:8080

<script src="http://localhost:8080/application.js" type="text/javascript"></script>



 > rails -s
 http://localhost:3000
Client

<script type="text/javascript">

  var jug = new Juggernaut;

  jug.subscribe("RubyDay", function(data){
    console.log("DATA: " + data);
  });

</script>
Server
require "juggernaut"

Juggernaut.publish("RubyDay", "Welcome")

// OR

Juggernaut.publish("RubyDay", {:data => "Welcome"})

// OR

Juggernaut.publish(["RubySpace", "RubyMine"], {:data =>
"Welcome"})
class PeopleController < ApplicationController
  require "juggernaut"
  def say_hello
   @user = {
               :name => “You”,
               :email => “lol@lol.com”
             }
        
     Juggernaut.publish( "RubyDay", @user ,
         :except => params[:juggernaut_id] )
     Juggernaut.publish( "RubyMine", @user ,
         :except => params[:juggernaut_id] )
    render :text => "SENT!"
    
  end
end
!    !     // RubyDay Users Channel
!    !     jug.subscribe( "RubyDay", function ( data )
!    !     {
!    !     !    console.log(data[ “name” ])
!      !   });
!    !     // RubyMine Users Channel
!    !     jug.subscribe( "RubyMine", function ( data )
!    !     {
    !!     console.log(data[ “email” ])
!      !   });
SocketStream
SocketStream
- Generate a new applications- Installing SS ( https://
github.com/socketstream/socketstream )    Dependencies: -
Redis            - Node.js             - NPM ( Node Package
Manager )
SocketStream
- Generate a new applications- Installing SS ( https://
github.com/socketstream/socketstream )    Dependencies: -
Redis            - Node.js             - NPM ( Node Package
Manager )




     > npm -g install socketstream
Install the bundled (optional) dependencies
> cd <name_of_your_project>
> npm install
To start your app simply type:
> node app.js

http://localhost:3000
Structure:
Structure:

/app /
client
app? /
css /
server /
shared /
views
Structure:

/app /       /lib /
client       client /
app? /       css /
css /        server
server /
shared /
views
Structure:

/app /       /lib /     /config
client       client /   app.coffee
app? /       css /      db.coffee
css /        server     events.coffee
server /                http.coffee
shared /
views
Structure:

/app /       /lib /     /config          /public   /
client       client /   app.coffee      assets
app? /       css /      db.coffee
css /        server     events.coffee
server /                http.coffee
shared /
views
Client


SS.socket.on 'disconnect', -> console.log 'Server is down'SS.socket.on 'reconnect', -> console.log 'Server is up'exports.init = ->	

   SS.server.app.init ( response ) -
>	

           	

            console.log response	

       	





 Server

exports.actions =! init: (cb) ->! !                                                                                        cb "Socket
Connection is Okay!"
Client
  Index


  SS.socket.on 'disconnect', -> console.log 'Server is down'SS.socket.on 'reconnect', -> console.log 'Server is up'exports.init = ->	

   SS.client.user.init( “João”, “Welcome to Ruby
  Day!” )

  SS.events.on 'RubyDay', ( params ) ->
   console.log “#{params[“user”]}, #{params[“message”]}”




  User
   exports.init = ( user, message )->
   SS.publish.broadcast RubyDay,
   !    !    !    {
   !    !    !    !    user: user,
   !    !    !    !    message: message
   !    !    !    }
Client
  Index


  SS.socket.on 'disconnect', -> console.log 'Server is down'SS.socket.on 'reconnect', -> console.log 'Server is up'exports.init = ->	

   SS.client.user.init( “João”, “Welcome to Ruby
  Day!” )

  SS.events.on 'RubyDay', ( params ) ->
   console.log “#{params[“user”]}, #{params[“message”]}”




  User
   exports.init = ( user, message )->
   SS.publish.broadcast RubyDay,
   !    !    !    {
   !    !    !    !    user: user,
   !    !    !    !    message: message
   !    !    !    }
Return
Return

 Both have your advantages, what is make you
choose how you should use is the characteristics
               of your project
OpenSource
OpenSource

Sweet - joaomdmoura.github.com/sweet
OpenSource

Sweet - joaomdmoura.github.com/sweet
Gioco - joaomdmoura.github.com/gioco
OpenSource

Sweet - joaomdmoura.github.com/sweet
Gioco - joaomdmoura.github.com/gioco
FriendsShit - friendsshit.com
Socket applications
Thank you!
Thank you!

@joaomdmourajoaomdmoura.comgithub.com/
            joaomdmoura
Thank you!
            Have a nice day!


@joaomdmourajoaomdmoura.comgithub.com/
            joaomdmoura

More Related Content

What's hot (20)

PDF
Django in the Real World
Jacob Kaplan-Moss
 
PDF
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
PDF
AnyMQ, Hippie, and the real-time web
clkao
 
PDF
Moving from Django Apps to Services
Craig Kerstiens
 
PDF
Django Performance Recipes
Jon Atkinson
 
PDF
The Best (and Worst) of Django
Jacob Kaplan-Moss
 
PDF
Introduction To Django (Strange Loop 2011)
Jacob Kaplan-Moss
 
PDF
Create responsive websites with Django, REST and AngularJS
Hannes Hapke
 
PDF
Keeping the frontend under control with Symfony and Webpack
Ignacio Martín
 
KEY
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Puppet
 
ODP
Exploiting the newer perl to improve your plugins
Marian Marinov
 
PDF
Django - 次の一歩 gumiStudy#3
makoto tsuyuki
 
PPTX
Maintainable JavaScript 2012
Nicholas Zakas
 
PPT
Web::Scraper
Tatsuhiko Miyagawa
 
KEY
Plack at OSCON 2010
Tatsuhiko Miyagawa
 
PDF
Hybrid Web Applications
James Da Costa
 
PDF
Building web framework with Rack
sickill
 
PDF
Master the New Core of Drupal 8 Now: with Symfony and Silex
Ryan Weaver
 
PDF
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Ryan Weaver
 
PPTX
REST with Eve and Python
PiXeL16
 
Django in the Real World
Jacob Kaplan-Moss
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
AnyMQ, Hippie, and the real-time web
clkao
 
Moving from Django Apps to Services
Craig Kerstiens
 
Django Performance Recipes
Jon Atkinson
 
The Best (and Worst) of Django
Jacob Kaplan-Moss
 
Introduction To Django (Strange Loop 2011)
Jacob Kaplan-Moss
 
Create responsive websites with Django, REST and AngularJS
Hannes Hapke
 
Keeping the frontend under control with Symfony and Webpack
Ignacio Martín
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Puppet
 
Exploiting the newer perl to improve your plugins
Marian Marinov
 
Django - 次の一歩 gumiStudy#3
makoto tsuyuki
 
Maintainable JavaScript 2012
Nicholas Zakas
 
Web::Scraper
Tatsuhiko Miyagawa
 
Plack at OSCON 2010
Tatsuhiko Miyagawa
 
Hybrid Web Applications
James Da Costa
 
Building web framework with Rack
sickill
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Ryan Weaver
 
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Ryan Weaver
 
REST with Eve and Python
PiXeL16
 

Viewers also liked (16)

PDF
Rankings, you're doing it wrong
João Moura
 
PDF
Building Products, not Apps
João Moura
 
PDF
AMS, API, RAILS and a developer, a Love Story
João Moura
 
DOC
Rubrica
myriamrondonflores
 
PDF
The Hard Task of Develop Products
João Moura
 
PDF
Network Architecture Based on Gaming
João Moura
 
PPTX
An overview of applying to other major destinations for JIS students.
Bridget Downey
 
PPT
L'univers
Jhon Mario Ibarra
 
PDF
Ey center-in-islamic-finance-for-africa-new
Benett Momory
 
PDF
Bonds & sukuks
Benett Momory
 
PDF
Stress Test as a Culture
João Moura
 
PDF
Harness the power of wordpress
Justin Ferrell
 
PDF
liquidity risk management
Benett Momory
 
PDF
islamic risk management
Benett Momory
 
PPTX
Fraccionamiento el carmen arq julio cgr junio 2012
Julio Ark's
 
Rankings, you're doing it wrong
João Moura
 
Building Products, not Apps
João Moura
 
AMS, API, RAILS and a developer, a Love Story
João Moura
 
The Hard Task of Develop Products
João Moura
 
Network Architecture Based on Gaming
João Moura
 
An overview of applying to other major destinations for JIS students.
Bridget Downey
 
Ey center-in-islamic-finance-for-africa-new
Benett Momory
 
Bonds & sukuks
Benett Momory
 
Stress Test as a Culture
João Moura
 
Harness the power of wordpress
Justin Ferrell
 
liquidity risk management
Benett Momory
 
islamic risk management
Benett Momory
 
Fraccionamiento el carmen arq julio cgr junio 2012
Julio Ark's
 
Ad

Similar to Socket applications (20)

PDF
Comet with node.js and V8
amix3k
 
PDF
TorqueBox at DC:JBUG - November 2011
bobmcwhirter
 
PDF
Real Time Web - What's that for?
Martyn Loughran
 
PDF
Realtime web apps rails
Ambert Ho
 
PDF
Ruby off Rails (english)
Stoyan Zhekov
 
PPTX
RoR guide_p1
Brady Cheng
 
KEY
Distributed app development with nodejs and zeromq
Ruben Tan
 
PPTX
10 Networking
Deepak Hagadur Bheemaraju
 
PDF
TorqueBox
bobmcwhirter
 
KEY
Intro to Ruby on Rails
rschmukler
 
KEY
Synchronous Reads Asynchronous Writes RubyConf 2009
pauldix
 
PDF
SocketStream
Paul Jensen
 
PDF
Node.js and Ruby
Michael Bleigh
 
PDF
TorqueBox for Rubyists
bobmcwhirter
 
KEY
Why ruby and rails
Reuven Lerner
 
PDF
Building Web APIs that Scale
Salesforce Developers
 
PDF
When Ruby Meets Java - The Power of Torquebox
rockyjaiswal
 
KEY
Rails web api 开发
shaokun
 
KEY
Servers with Event Machine - David Troy - RailsConf 2011
David Troy
 
KEY
TorqueBox - Ruby Hoedown 2011
Lance Ball
 
Comet with node.js and V8
amix3k
 
TorqueBox at DC:JBUG - November 2011
bobmcwhirter
 
Real Time Web - What's that for?
Martyn Loughran
 
Realtime web apps rails
Ambert Ho
 
Ruby off Rails (english)
Stoyan Zhekov
 
RoR guide_p1
Brady Cheng
 
Distributed app development with nodejs and zeromq
Ruben Tan
 
TorqueBox
bobmcwhirter
 
Intro to Ruby on Rails
rschmukler
 
Synchronous Reads Asynchronous Writes RubyConf 2009
pauldix
 
SocketStream
Paul Jensen
 
Node.js and Ruby
Michael Bleigh
 
TorqueBox for Rubyists
bobmcwhirter
 
Why ruby and rails
Reuven Lerner
 
Building Web APIs that Scale
Salesforce Developers
 
When Ruby Meets Java - The Power of Torquebox
rockyjaiswal
 
Rails web api 开发
shaokun
 
Servers with Event Machine - David Troy - RailsConf 2011
David Troy
 
TorqueBox - Ruby Hoedown 2011
Lance Ball
 
Ad

More from João Moura (6)

PDF
Gamification - Uma nova Fronteira
João Moura
 
PDF
Desenvolvendo Produtos, Não Aplicativos
João Moura
 
PDF
Construindo Aplicações com Zero Load Time
João Moura
 
PDF
Rankings, você esta fazendo isso errado
João Moura
 
KEY
Gamification Theory and Gioco
João Moura
 
KEY
WebSocket com Node.js ( socketstream && coffeescript ) X RoR ( Juggernaut )
João Moura
 
Gamification - Uma nova Fronteira
João Moura
 
Desenvolvendo Produtos, Não Aplicativos
João Moura
 
Construindo Aplicações com Zero Load Time
João Moura
 
Rankings, você esta fazendo isso errado
João Moura
 
Gamification Theory and Gioco
João Moura
 
WebSocket com Node.js ( socketstream && coffeescript ) X RoR ( Juggernaut )
João Moura
 

Recently uploaded (20)

PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Python basic programing language for automation
DanialHabibi2
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
July Patch Tuesday
Ivanti
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 

Socket applications

Editor's Notes

  • #2: My name, where and how you can found me, joke in Italian.\n- I&apos;ve been a developer for 6 years\n- Love open source development\n
  • #3: My name, where and how you can found me, joke in Italian.\n- I&apos;ve been a developer for 6 years\n- Love open source development\n
  • #4: I&amp;#x2019;m from Brazil! A Great country, let they know a little bit about it.\n
  • #5: This is S&amp;#xE3;o Paulo, where I live and work, a really big town, actually the sixth largest in the world\n
  • #6: Actually I&amp;#x2019;m working on CodeMiner42 as Consultant and System Engineer developing Ruby applications, the propose is a true agile software development without bureaucracy and focused in Startups\n
  • #7: Well now you already know who I&amp;#x2019;m, let&amp;#x2019;s gonna talk about what I came to speak to you guys, Socket Applications. In this talk I will answer three basic questions that we developers should ask ourself before start to use some technology, What, Why and How.\n
  • #8: There is some web applications that the content traffic is constant. For example a chat, a livestream of feed or even public APIs.\nThe usual solution is use javascript to make Ajax requests in regular times to an server that will return the content that your application are looking for. This have a name, this is polling, and this is not the right way to do it.\n
  • #9: There is some web applications that the content traffic is constant. For example a chat, a livestream of feed or even public APIs.\nThe usual solution is use javascript to make Ajax requests in regular times to an server that will return the content that your application are looking for. This have a name, this is polling, and this is not the right way to do it.\n
  • #10: There is some web applications that the content traffic is constant. For example a chat, a livestream of feed or even public APIs.\nThe usual solution is use javascript to make Ajax requests in regular times to an server that will return the content that your application are looking for. This have a name, this is polling, and this is not the right way to do it.\n
  • #11: There is some web applications that the content traffic is constant. For example a chat, a livestream of feed or even public APIs.\nThe usual solution is use javascript to make Ajax requests in regular times to an server that will return the content that your application are looking for. This have a name, this is polling, and this is not the right way to do it.\n
  • #12: There is some web applications that the content traffic is constant. For example a chat, a livestream of feed or even public APIs.\nThe usual solution is use javascript to make Ajax requests in regular times to an server that will return the content that your application are looking for. This have a name, this is polling, and this is not the right way to do it.\n
  • #13: \n
  • #14: Basically we have two problems:\n\nRails and most of used languages to develop web applications don&amp;#x2019;t support multiples simultaneously connections.\nAn there is also the synchronous I/O, the real problem, if the server are saving an archive or doing a query in database this process have to wait before continue.\n
  • #15: Basically we have two problems:\n\nRails and most of used languages to develop web applications don&amp;#x2019;t support multiples simultaneously connections.\nAn there is also the synchronous I/O, the real problem, if the server are saving an archive or doing a query in database this process have to wait before continue.\n
  • #16: The solution is use a multi-thread model with an asynchronous I/O, change the procedural structure for another pattern, for a Reactor, an event handling pattern, as used by Event Machine. (Heroku, GitHub, 37signals, Engine Yard, PostRank). The idea behind Reactor pattern is instead of waiting on a response from network, use that time to process another request.\nIntelligently preload data.\n
  • #17: The solution is use a multi-thread model with an asynchronous I/O, change the procedural structure for another pattern, for a Reactor, an event handling pattern, as used by Event Machine. (Heroku, GitHub, 37signals, Engine Yard, PostRank). The idea behind Reactor pattern is instead of waiting on a response from network, use that time to process another request.\nIntelligently preload data.\n
  • #18: The solution is use a multi-thread model with an asynchronous I/O, change the procedural structure for another pattern, for a Reactor, an event handling pattern, as used by Event Machine. (Heroku, GitHub, 37signals, Engine Yard, PostRank). The idea behind Reactor pattern is instead of waiting on a response from network, use that time to process another request.\nIntelligently preload data.\n
  • #19: An this is exactly what socket is about, the word &quot;socket&quot; as we know it, have some aspects there are related with the socket technology, basically a socket connection have the same concept of a socket when plugged, there&apos;s two fluxes , one that transmit the power to the machine and other that send back the power to the plug.\n
  • #20: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #21: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #22: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #23: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #24: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #25: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #26: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #27: A normal application or web site, communicate with a server by patches, a user request a page or some information from your server, where your application are hosted, when this request get in the server, a connections is established, the server will do the pre-process necessary, and will serve the information the user are looking for, closing the connection.\n\nFor security reasons the connections is always requested or approved by the client, the server can&amp;#x2019;t figure out who is every client.\n
  • #28: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #29: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #30: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #31: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #32: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #33: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #34: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #35: When we are talking about a connection with a socket server, everything start similar, but when the request made, get in the server and the connection is established ( the word used to describe a successfully connection is handshake ), it will never close the connections until you tell the system to do it or shutdown the server.\n\nUsually the sockets connections are grouped by channels, so you can have multiple channels and multiple clients connected in each one.\n\nIf you think just about a connection that never end, maybe you won&apos;t see all the benefits of this kind of application, when you have more then one client connected to this server you can start to think in the server like a bridge between all your clients, allowing they to interact each other, changing completely their experience in the application.\n\nIt actually gives you realtime connection between your servers and client browsers. You can literally push data to clients using your web application, you can push data from your server to your clients allowing interaction between users.\n
  • #36: Why should I develop applications using socket technology? \n- The internet is not about being connected anymore, it&amp;#x2019;s about do it better, faster and simpler. \n- As faster as new technologies are coming the market are looking for innovation.\n- Users are looking everyday for applications that can offer a new way of getting and share information.\n- I&apos;m not talking only about websites, games or any other specific kind of application, I&apos;m talking about user experience\n- Sockets is one of the technologies that make possible a new range of applications, a network socket is an endpoint of an inter-process communication flow across a computer network.\n
  • #37: Web developers are still stuck in the request/response mindset. every UI interaction results in a delay before another interaction can be performed. That&apos;s the process we&apos;ve used our entire careers so it&apos;s no wonder most developers are blinkered to the alternatives.\n\nSpeed matters; a lot. Or to be precise, perceived speed matters a lot\n\ndevelopers still insist on using the request/response model. Even the introduction of Ajax hasn&apos;t improved the scene much, replacing blank loading states with spinners.\nUsers would just like to use your application without any interruptions.\n
  • #38: Web developers are still stuck in the request/response mindset. every UI interaction results in a delay before another interaction can be performed. That&apos;s the process we&apos;ve used our entire careers so it&apos;s no wonder most developers are blinkered to the alternatives.\n\nSpeed matters; a lot. Or to be precise, perceived speed matters a lot\n\ndevelopers still insist on using the request/response model. Even the introduction of Ajax hasn&apos;t improved the scene much, replacing blank loading states with spinners.\nUsers would just like to use your application without any interruptions.\n
  • #39: Web developers are still stuck in the request/response mindset. every UI interaction results in a delay before another interaction can be performed. That&apos;s the process we&apos;ve used our entire careers so it&apos;s no wonder most developers are blinkered to the alternatives.\n\nSpeed matters; a lot. Or to be precise, perceived speed matters a lot\n\ndevelopers still insist on using the request/response model. Even the introduction of Ajax hasn&apos;t improved the scene much, replacing blank loading states with spinners.\nUsers would just like to use your application without any interruptions.\n
  • #40: Contribute for Single Page Applications concept.\nMore dynamic application with a better performance.\n
  • #41: \n
  • #42: There is a lot of ways to develop a socket application.\nBut you must start to think different, you must understand that isn&amp;#x2019;t all applications that can be converted to a client side app, you must start to think about architecture, about DCI (Data Context and Interaction) and patterns. The most useful pattern now a days are RestFull applications with an json interface\n
  • #43: There is a lot of ways to develop a socket application.\nBut you must start to think different, you must understand that isn&amp;#x2019;t all applications that can be converted to a client side app, you must start to think about architecture, about DCI (Data Context and Interaction) and patterns. The most useful pattern now a days are RestFull applications with an json interface\n
  • #44: There is a lot of tools that can provide you a simple or very complex environment to implement or even develop a whole application using frameworks focused in sockets applications.\n\nAn this are just some of the options, some of those are language independent, others use an external service as Pusher, there is the Juggernaut gem ( from Alex Maccaw ), and even a whole framework, the SocketStream a Node.js based solution, and another Cramp build on top of EventMachine for Ruby.\n\nThe most of those solutions have some relation with Redis.\n
  • #45: There is a lot of tools that can provide you a simple or very complex environment to implement or even develop a whole application using frameworks focused in sockets applications.\n\nAn this are just some of the options, some of those are language independent, others use an external service as Pusher, there is the Juggernaut gem ( from Alex Maccaw ), and even a whole framework, the SocketStream a Node.js based solution, and another Cramp build on top of EventMachine for Ruby.\n\nThe most of those solutions have some relation with Redis.\n
  • #46: You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.\n\nIn order to achieve its outstanding performance, Redis works with an in-memory dataset. \n\nDepending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log.\n
  • #47: You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.\n\nIn order to achieve its outstanding performance, Redis works with an in-memory dataset. \n\nDepending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log.\n
  • #48: You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.\n\nIn order to achieve its outstanding performance, Redis works with an in-memory dataset. \n\nDepending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log.\n
  • #49: Now let practice, I decide to introduce to you guys two solutions, one in Ruby, using Rails, and another one Node.js based.\nYou may asking yourself why those two.\nCause I love Ruby and Javascript, but also cause both has the best costs x benefits that I already used until now.\nI would give a try to Cramp too, and some more advanced tool as &amp;#xD8;MQ but I don&amp;#x2019;t had the opportunity to get depth into those yet.\nBut why I love Ruby and Javascript? Cause both don&amp;#x2019;t make sense sometimes.\nI saw this talk on youtube from Gary Bernhardt and decide to bring this to you guys before we started with serious code.\n
  • #50: Now let practice, I decide to introduce to you guys two solutions, one in Ruby, using Rails, and another one Node.js based.\nYou may asking yourself why those two.\nCause I love Ruby and Javascript, but also cause both has the best costs x benefits that I already used until now.\nI would give a try to Cramp too, and some more advanced tool as &amp;#xD8;MQ but I don&amp;#x2019;t had the opportunity to get depth into those yet.\nBut why I love Ruby and Javascript? Cause both don&amp;#x2019;t make sense sometimes.\nI saw this talk on youtube from Gary Bernhardt and decide to bring this to you guys before we started with serious code.\n
  • #51: Now let practice, I decide to introduce to you guys two solutions, one in Ruby, using Rails, and another one Node.js based.\nYou may asking yourself why those two.\nCause I love Ruby and Javascript, but also cause both has the best costs x benefits that I already used until now.\nI would give a try to Cramp too, and some more advanced tool as &amp;#xD8;MQ but I don&amp;#x2019;t had the opportunity to get depth into those yet.\nBut why I love Ruby and Javascript? Cause both don&amp;#x2019;t make sense sometimes.\nI saw this talk on youtube from Gary Bernhardt and decide to bring this to you guys before we started with serious code.\n
  • #52: Now let practice, I decide to introduce to you guys two solutions, one in Ruby, using Rails, and another one Node.js based.\nYou may asking yourself why those two.\nCause I love Ruby and Javascript, but also cause both has the best costs x benefits that I already used until now.\nI would give a try to Cramp too, and some more advanced tool as &amp;#xD8;MQ but I don&amp;#x2019;t had the opportunity to get depth into those yet.\nBut why I love Ruby and Javascript? Cause both don&amp;#x2019;t make sense sometimes.\nI saw this talk on youtube from Gary Bernhardt and decide to bring this to you guys before we started with serious code.\n
  • #53: Now let practice, I decide to introduce to you guys two solutions, one in Ruby, using Rails, and another one Node.js based.\nYou may asking yourself why those two.\nCause I love Ruby and Javascript, but also cause both has the best costs x benefits that I already used until now.\nI would give a try to Cramp too, and some more advanced tool as &amp;#xD8;MQ but I don&amp;#x2019;t had the opportunity to get depth into those yet.\nBut why I love Ruby and Javascript? Cause both don&amp;#x2019;t make sense sometimes.\nI saw this talk on youtube from Gary Bernhardt and decide to bring this to you guys before we started with serious code.\n
  • #54: You guys know what WAT means?\n
  • #55: Lets talk about Ruby\n
  • #56: Lets talk about Ruby\n
  • #57: Lets talk about Ruby\n
  • #58: Lets talk about Javascript\n
  • #59: Lets talk about Javascript\n
  • #60: \n
  • #61: Lets stop talk about languages that sucks lets talk about javascript\n
  • #62: Lets stop talk about languages that sucks lets talk about javascript\n
  • #63: Lets stop talk about languages that sucks lets talk about javascript\n
  • #64: Lets stop talk about languages that sucks lets talk about javascript\n
  • #65: Lets stop talk about languages that sucks lets talk about javascript\n
  • #66: Lets stop talk about languages that sucks lets talk about javascript\n
  • #67: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #68: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #69: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #70: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #71: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #72: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #73: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #74: \n
  • #75: \n
  • #76: \n
  • #77: \n
  • #78: \n
  • #79: SocketStream is an open source Node.js web framework dedicated to building single-page realtime apps.Whether you&apos;re building a group chat app, multiplayer game, trading platform, sales dashboard, or any other realtime web app, SocketStream gets you up and running quickly by providing essential functionality and a rapid development environment.\nOn the client-side, you&apos;re free to use all the technologies you already know and love - such as jQuery, Mustache, Backbone.js, Ember.js, Angular.js\nSocketStream apps can easily be deployed to Nodejitsu, EC2 servers or any other hosting platform supporting websockets (sadly that excludes Heroku for the moment).\nWorks great with Chrome, Safari, Firefox 6 (and above) using native websockets\n\nWhen you run in production mode these files are automatically packed and minified into one CSS, JS and HTML file per-client.\n\nOptionally use Redis for fast session retrieval, pub/sub, list of users online, and any other data your app needs instantly\n
  • #80: SocketStream is an open source Node.js web framework dedicated to building single-page realtime apps.Whether you&apos;re building a group chat app, multiplayer game, trading platform, sales dashboard, or any other realtime web app, SocketStream gets you up and running quickly by providing essential functionality and a rapid development environment.\nOn the client-side, you&apos;re free to use all the technologies you already know and love - such as jQuery, Mustache, Backbone.js, Ember.js, Angular.js\nSocketStream apps can easily be deployed to Nodejitsu, EC2 servers or any other hosting platform supporting websockets (sadly that excludes Heroku for the moment).\nWorks great with Chrome, Safari, Firefox 6 (and above) using native websockets\n\nWhen you run in production mode these files are automatically packed and minified into one CSS, JS and HTML file per-client.\n\nOptionally use Redis for fast session retrieval, pub/sub, list of users online, and any other data your app needs instantly\n
  • #81: \n
  • #82: \n
  • #83: \n
  • #84: \n
  • #85: \n
  • #86: \n
  • #87: \n
  • #88: \n
  • #89: Is super simple and easy to get going. As I said the juggernaut also use Node.js server.\nIt is supported by the most commons browsers in desktop and mobile.\n
  • #90: \n
  • #91: \n
  • #92: \n
  • #93: My name, where and how you can found me, joke in Italian.\n- I&apos;ve been a developer for 6 years\n- Love open source development\n
  • #94: My name, where and how you can found me, joke in Italian.\n- I&apos;ve been a developer for 6 years\n- Love open source development\n
  • #95: My name, where and how you can found me, joke in Italian.\n- I&apos;ve been a developer for 6 years\n- Love open source development\n