SlideShare a Scribd company logo
1 of 12
Download to read offline
Damian Martinelli
WebSockets en Ruby en 5 Minutos
(despues vemos qué hacemos con los 25 minutos restantes)
 Damian Martinelli
 Ingeniero en Informática (UBA)
 Sumavisos (www.sumavisos.com)
 DO2 Online Solutions (www.do2online.com)
 damianmarti@gmail.com
 @damianmarti
Damian Martinelli
Interacciones
Damian Martinelli
Sobre HTTP
 Internet-Draft
 http://www.whatwg.org/specs/web-socket-protocol/
 GET /demo HTTP/1.1
 Upgrade: WebSocket
Damian Martinelli
WebSocket API
 http://dev.w3.org/html5/websockets/
interface WebSocket {
....
attribute Function onopen;
attribute Function onmessage;
attribute Function onerror;
attribute Function onclose;
...
void send(in DOMString data);
void close();
};
Damian Martinelli
Servidor Ruby
 EM-WebSocket
 https://github.com/igrigorik/em-websocket
EventMachine.run {
EventMachine::WebSocket.start(:host=>'0.0.0.0',:port=>8080) do |socket|
socket.onopen {
socket.send 'Websocket connection open'
}
socket.onmessage {|msg|
socket.send "Received message: #{msg}"
}
end
}
Damian Martinelli
Cliente Ruby
 Web-socket-ruby
 https://github.com/gimite/web-socket-ruby
# Connects to Web Socket server at host example.com port 10081.
client = WebSocket.new("ws://example.com:10081”)
# Sends a message to the server.
client.send("Hello")
# Receives a message from the server.
data = client.receive()
Damian Martinelli
Cliente JavaScript
 Soporte de WebSocket JS en el Browser
var socket = new WebSocket('ws://localhost:8080');
socket.onmessage = function( evt ) {
$('<li>')
.text(evt.data)
.appendTo('#messages');
}
socket.send(message);
Damian Martinelli
Protocolo para los Mensajes
 JSON?
{
“event”: “new_car”,
“data”:{
“brand” : “VW”,
“model” : ”Golf”
}
}
Damian Martinelli
Cliente JavaScript Reloaded
 FancyWebSocket
 https://github.com/ismasan/websockets_examples
socket.bind( 'user_connected', function (user_data) {
$('#connected_users').append('<li>' + user_data.name + '</li>');
});
socket.bind( 'user_message', function (msg_data) {
$('#messages').append('<li>' + msg_data.message + '</li>');
});
socket.send( 'user_message', {name: 'Ismael', message: msg} );
Damian Martinelli
Casos de Uso
 Chat
 Juegos
 Colaboración
 Notificaciones en Tiempo Real
 Qué más?
Damian Martinelli
A Jugar!!
 Chat
 Pizarra
 ToDo List
 Sumavisos Parsers Activity Dashboard
Damian Martinelli
Preguntas?
@damianmarti
damianmarti@gmail.com
Gracias!!!

More Related Content

What's hot

Installar un paquete_rpm_linux
Installar un paquete_rpm_linuxInstallar un paquete_rpm_linux
Installar un paquete_rpm_linuxJames Jara
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serializationGWTcon
 
WebSocket Server - Jul 2010
WebSocket Server - Jul 2010WebSocket Server - Jul 2010
WebSocket Server - Jul 2010takanao ENODH
 
Google country day_intervento
Google country day_interventoGoogle country day_intervento
Google country day_interventofirenze-gtug
 
Instalar un repositorio_centos
Instalar un repositorio_centosInstalar un repositorio_centos
Instalar un repositorio_centosJames Jara
 
Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?Ericom Software
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)Ericom Software
 
Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Yasuyuki Sugai
 
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersWebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersViktor Gamov
 
Velocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackVelocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackCosimo Streppone
 

What's hot (17)

Installar un paquete_rpm_linux
Installar un paquete_rpm_linuxInstallar un paquete_rpm_linux
Installar un paquete_rpm_linux
 
Raspberry home server
Raspberry home serverRaspberry home server
Raspberry home server
 
Web socket with php v2
Web socket with php v2Web socket with php v2
Web socket with php v2
 
Socket.io
Socket.ioSocket.io
Socket.io
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
 
WebSocket Server - Jul 2010
WebSocket Server - Jul 2010WebSocket Server - Jul 2010
WebSocket Server - Jul 2010
 
Google country day_intervento
Google country day_interventoGoogle country day_intervento
Google country day_intervento
 
Instalar un repositorio_centos
Instalar un repositorio_centosInstalar un repositorio_centos
Instalar un repositorio_centos
 
Websocket shanon
Websocket shanonWebsocket shanon
Websocket shanon
 
Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編
 
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersWebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
 
Velocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackVelocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attack
 
Websockets
WebsocketsWebsockets
Websockets
 
Web Sockets - HTML5
Web Sockets - HTML5Web Sockets - HTML5
Web Sockets - HTML5
 
Windows command N to O
Windows command N to OWindows command N to O
Windows command N to O
 

Viewers also liked

201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuildingWout Visser
 
Hospital C-Suite Whitepaper 2014
Hospital C-Suite Whitepaper 2014Hospital C-Suite Whitepaper 2014
Hospital C-Suite Whitepaper 2014Chris Corwin
 
Brasil III PPS by Sonia Medeiros
Brasil III PPS by Sonia MedeirosBrasil III PPS by Sonia Medeiros
Brasil III PPS by Sonia MedeirosSonia Medeiros
 
The future of remote teams: how to fine-tune virtual collaboration?
The future of remote teams: how to fine-tune virtual collaboration?The future of remote teams: how to fine-tune virtual collaboration?
The future of remote teams: how to fine-tune virtual collaboration?Wrike
 
Geologic Column
Geologic ColumnGeologic Column
Geologic Columncharsh
 
Transmedia and Augmented Reality
Transmedia and Augmented RealityTransmedia and Augmented Reality
Transmedia and Augmented RealityRobert Pratten
 
Network First Open Day presentation
Network First Open Day presentationNetwork First Open Day presentation
Network First Open Day presentationVictoria College
 
Mixtures
MixturesMixtures
Mixturescharsh
 
Kagaya Yutaka Art - PPS by Sonia Medeiros
Kagaya Yutaka Art - PPS by Sonia MedeirosKagaya Yutaka Art - PPS by Sonia Medeiros
Kagaya Yutaka Art - PPS by Sonia MedeirosSonia Medeiros
 
Mid Year Outlook 2010
Mid Year Outlook 2010Mid Year Outlook 2010
Mid Year Outlook 2010scottbrooker
 
Soil Powerpt Andie
Soil Powerpt AndieSoil Powerpt Andie
Soil Powerpt Andiecharsh
 
Sustainable Design for Occupants to Achieve High Performance and Low Energy B...
Sustainable Design for Occupants to Achieve High Performance and Low Energy B...Sustainable Design for Occupants to Achieve High Performance and Low Energy B...
Sustainable Design for Occupants to Achieve High Performance and Low Energy B...Nicolas Carbone Gamarra
 
High Altitude Food Gardening - Evergreen Library 2/13/16
High Altitude Food Gardening - Evergreen Library 2/13/16High Altitude Food Gardening - Evergreen Library 2/13/16
High Altitude Food Gardening - Evergreen Library 2/13/16Web Sites for Good
 
McCormick Mobile Media - Mobile Giving
McCormick Mobile Media - Mobile GivingMcCormick Mobile Media - Mobile Giving
McCormick Mobile Media - Mobile GivingEric McCormick
 

Viewers also liked (20)

201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding
 
Hospital C-Suite Whitepaper 2014
Hospital C-Suite Whitepaper 2014Hospital C-Suite Whitepaper 2014
Hospital C-Suite Whitepaper 2014
 
To be present1 eso
To be present1 esoTo be present1 eso
To be present1 eso
 
Future Tenses
Future TensesFuture Tenses
Future Tenses
 
Brasil III PPS by Sonia Medeiros
Brasil III PPS by Sonia MedeirosBrasil III PPS by Sonia Medeiros
Brasil III PPS by Sonia Medeiros
 
The future of remote teams: how to fine-tune virtual collaboration?
The future of remote teams: how to fine-tune virtual collaboration?The future of remote teams: how to fine-tune virtual collaboration?
The future of remote teams: how to fine-tune virtual collaboration?
 
Geologic Column
Geologic ColumnGeologic Column
Geologic Column
 
Transmedia and Augmented Reality
Transmedia and Augmented RealityTransmedia and Augmented Reality
Transmedia and Augmented Reality
 
Se acerca un gran día
Se acerca un gran díaSe acerca un gran día
Se acerca un gran día
 
Red hook
Red hookRed hook
Red hook
 
Network First Open Day presentation
Network First Open Day presentationNetwork First Open Day presentation
Network First Open Day presentation
 
Mixtures
MixturesMixtures
Mixtures
 
Kagaya Yutaka Art - PPS by Sonia Medeiros
Kagaya Yutaka Art - PPS by Sonia MedeirosKagaya Yutaka Art - PPS by Sonia Medeiros
Kagaya Yutaka Art - PPS by Sonia Medeiros
 
Format makalah DDP MIPA
Format makalah DDP MIPA Format makalah DDP MIPA
Format makalah DDP MIPA
 
Mid Year Outlook 2010
Mid Year Outlook 2010Mid Year Outlook 2010
Mid Year Outlook 2010
 
Soil Powerpt Andie
Soil Powerpt AndieSoil Powerpt Andie
Soil Powerpt Andie
 
Redes Sociales2
Redes Sociales2Redes Sociales2
Redes Sociales2
 
Sustainable Design for Occupants to Achieve High Performance and Low Energy B...
Sustainable Design for Occupants to Achieve High Performance and Low Energy B...Sustainable Design for Occupants to Achieve High Performance and Low Energy B...
Sustainable Design for Occupants to Achieve High Performance and Low Energy B...
 
High Altitude Food Gardening - Evergreen Library 2/13/16
High Altitude Food Gardening - Evergreen Library 2/13/16High Altitude Food Gardening - Evergreen Library 2/13/16
High Altitude Food Gardening - Evergreen Library 2/13/16
 
McCormick Mobile Media - Mobile Giving
McCormick Mobile Media - Mobile GivingMcCormick Mobile Media - Mobile Giving
McCormick Mobile Media - Mobile Giving
 

Similar to Websockets en Ruby en 5 Minutos

Realizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone BordetRealizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone BordetCodemotion
 
Jetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerJetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerCodemotion
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTCGiacomo Vacca
 
Real Time Web - What's that for?
Real Time Web - What's that for?Real Time Web - What's that for?
Real Time Web - What's that for?Martyn Loughran
 
Exploring web apps with Fiddler and Chrome Dev Tools
Exploring web apps with Fiddler and Chrome Dev ToolsExploring web apps with Fiddler and Chrome Dev Tools
Exploring web apps with Fiddler and Chrome Dev ToolsCristian Satnic
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
WebSocketでリアルタイム通信
WebSocketでリアルタイム通信WebSocketでリアルタイム通信
WebSocketでリアルタイム通信Kensaku Komatsu
 
Hello websocket(cn)
Hello websocket(cn)Hello websocket(cn)
Hello websocket(cn)g65537
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAriya Hidayat
 
Creating 3 Beautiful Apps At Once - Intro To Xamarin.Forms
Creating 3 Beautiful Apps At Once - Intro To Xamarin.FormsCreating 3 Beautiful Apps At Once - Intro To Xamarin.Forms
Creating 3 Beautiful Apps At Once - Intro To Xamarin.FormsMatthew Soucoup
 
Introducción a Wiremock
Introducción a WiremockIntroducción a Wiremock
Introducción a WiremockJose Ortiz
 
Ruby and Framework Security
Ruby and Framework SecurityRuby and Framework Security
Ruby and Framework SecurityCreston Jamison
 
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...Uniface
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On FireJef Claes
 
Node home automation with Node.js and MQTT
Node home automation with Node.js and MQTTNode home automation with Node.js and MQTT
Node home automation with Node.js and MQTTMichael Dawson
 

Similar to Websockets en Ruby en 5 Minutos (20)

Realizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone BordetRealizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone Bordet
 
110828recruit agent ws
110828recruit agent ws110828recruit agent ws
110828recruit agent ws
 
Jetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerJetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet Container
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC
 
Real Time Web - What's that for?
Real Time Web - What's that for?Real Time Web - What's that for?
Real Time Web - What's that for?
 
Exploring web apps with Fiddler and Chrome Dev Tools
Exploring web apps with Fiddler and Chrome Dev ToolsExploring web apps with Fiddler and Chrome Dev Tools
Exploring web apps with Fiddler and Chrome Dev Tools
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
 
WebSocketでリアルタイム通信
WebSocketでリアルタイム通信WebSocketでリアルタイム通信
WebSocketでリアルタイム通信
 
Hello websocket(cn)
Hello websocket(cn)Hello websocket(cn)
Hello websocket(cn)
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
 
HTTPS and HTTP/2
HTTPS and HTTP/2HTTPS and HTTP/2
HTTPS and HTTP/2
 
Creating 3 Beautiful Apps At Once - Intro To Xamarin.Forms
Creating 3 Beautiful Apps At Once - Intro To Xamarin.FormsCreating 3 Beautiful Apps At Once - Intro To Xamarin.Forms
Creating 3 Beautiful Apps At Once - Intro To Xamarin.Forms
 
Introducción a Wiremock
Introducción a WiremockIntroducción a Wiremock
Introducción a Wiremock
 
Ruby and Framework Security
Ruby and Framework SecurityRuby and Framework Security
Ruby and Framework Security
 
Swt 2009
Swt 2009Swt 2009
Swt 2009
 
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On Fire
 
Node home automation with Node.js and MQTT
Node home automation with Node.js and MQTTNode home automation with Node.js and MQTT
Node home automation with Node.js and MQTT
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
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
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
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
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
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
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
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
 
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
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
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
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
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
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
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
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
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
 
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
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 

Websockets en Ruby en 5 Minutos

  • 1. Damian Martinelli WebSockets en Ruby en 5 Minutos (despues vemos qué hacemos con los 25 minutos restantes)  Damian Martinelli  Ingeniero en Informática (UBA)  Sumavisos (www.sumavisos.com)  DO2 Online Solutions (www.do2online.com)  damianmarti@gmail.com  @damianmarti
  • 3. Damian Martinelli Sobre HTTP  Internet-Draft  http://www.whatwg.org/specs/web-socket-protocol/  GET /demo HTTP/1.1  Upgrade: WebSocket
  • 4. Damian Martinelli WebSocket API  http://dev.w3.org/html5/websockets/ interface WebSocket { .... attribute Function onopen; attribute Function onmessage; attribute Function onerror; attribute Function onclose; ... void send(in DOMString data); void close(); };
  • 5. Damian Martinelli Servidor Ruby  EM-WebSocket  https://github.com/igrigorik/em-websocket EventMachine.run { EventMachine::WebSocket.start(:host=>'0.0.0.0',:port=>8080) do |socket| socket.onopen { socket.send 'Websocket connection open' } socket.onmessage {|msg| socket.send "Received message: #{msg}" } end }
  • 6. Damian Martinelli Cliente Ruby  Web-socket-ruby  https://github.com/gimite/web-socket-ruby # Connects to Web Socket server at host example.com port 10081. client = WebSocket.new("ws://example.com:10081”) # Sends a message to the server. client.send("Hello") # Receives a message from the server. data = client.receive()
  • 7. Damian Martinelli Cliente JavaScript  Soporte de WebSocket JS en el Browser var socket = new WebSocket('ws://localhost:8080'); socket.onmessage = function( evt ) { $('<li>') .text(evt.data) .appendTo('#messages'); } socket.send(message);
  • 8. Damian Martinelli Protocolo para los Mensajes  JSON? { “event”: “new_car”, “data”:{ “brand” : “VW”, “model” : ”Golf” } }
  • 9. Damian Martinelli Cliente JavaScript Reloaded  FancyWebSocket  https://github.com/ismasan/websockets_examples socket.bind( 'user_connected', function (user_data) { $('#connected_users').append('<li>' + user_data.name + '</li>'); }); socket.bind( 'user_message', function (msg_data) { $('#messages').append('<li>' + msg_data.message + '</li>'); }); socket.send( 'user_message', {name: 'Ismael', message: msg} );
  • 10. Damian Martinelli Casos de Uso  Chat  Juegos  Colaboración  Notificaciones en Tiempo Real  Qué más?
  • 11. Damian Martinelli A Jugar!!  Chat  Pizarra  ToDo List  Sumavisos Parsers Activity Dashboard