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

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

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