SlideShare una empresa de Scribd logo
1 de 13
Descargar para leer sin conexión
WebSocket
Two-way realtime communication for websites
Chat on a webpage




“Four times.”   “Four times.”
Chat on a webpage

Requirements:

• Send messages client→server
• Send messages server→client
• Detect when client is connected to server
  (“presence”)
Traditional HTTP



XMLHttpRequest                        Long Polling
(HTTP from JavaScript)                (Long-running XMLHttpRequest)
var request = new XMLHttpRequest();   var request = new XMLHttpRequest();
request.open("POST", "/send");        request.open("GET", "/receive");
request.send("Four times.");          request.send();
                                      request.onload = function() {
                                          appendMessage(this.responseText);
                                          startNewRequest();
                                      };
Other techniques and problems

• Long-polling HTTP requests: XHR, script-tag
• Streaming HTTP request: XHR, iframe
• Using rtmp with Flash

• Misuse of HTTP (proxies, browsers, servers)
• Performance (network, httpd cpu)
• Not supported in all browsers
WebSocket

• Full-duplex persistent connection over TCP
• Designed by W3C for the web (RFC Dec. ’11)
• Uses port 80
• Handshake features HTTP’s “Upgrade”-header
• The TLS version passes some HTTP-proxies
• Ping/pong frames for staying alive
WebSocket JavaScript API


var ws = new WebSocket("wss://host");   var ws = new WebSocket("wss://host");
ws.send("Four times.");                 ws.onmessage = function(event) {
ws.send("It has to be.");                   appendMessage(event.data);
                                        };
Demo
├── README.md
├── client-sockjs
│   ├── chat.js
│   └── index.html
├── client-websocket
│   ├── chat.js
│   └── index.html
└── server
 ├── package.json
 └── server.js

 https://github.com/njam/websocket-demo-chat
Compatibility




http://caniuse.com/websockets
Emulation

• WebSocket-like client-API plus server
• Enables realtime-comm. in most used browsers

• SockJS: Node.js, Erlang, Ruby, Python, ..
• Socket.IO: Node.js, Java, Erlang, PHP, .......
• Ratchet: PHP
• APE (C), Atmosphere (Java), Tambur.io (WS),
  Pusher (WS)
Server application Integration

1. Same application base:
   WS-server which reuses your app code



                Application code


   Apache                          WS Server
Server application Integration

2. Message Queue / Service API:
   Messaging between app and WS server
  (Redis-SockJS push-only broker: cargomedia/socket-redis)

                     Message Queue
Application code                            Broker


    Apache                                WS Server
Thanks



cargomedia.ch/jobs

Más contenido relacionado

La actualidad más candente

From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Clusterguestd34230
 
Alternative Infrastucture
Alternative InfrastuctureAlternative Infrastucture
Alternative InfrastuctureMarc Seeger
 
Phorum MySQL tricks
Phorum MySQL tricksPhorum MySQL tricks
Phorum MySQL tricksguestd34230
 
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1Mickaël Rémond
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeLenz Gschwendtner
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beersjorgecarabias
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaJames Falkner
 
HTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS moduleHTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS moduleKazuho Oku
 
Using Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldUsing Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldGil Fink
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with javaJeongHun Byeon
 
Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)
Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)
Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)leifwalsh
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQNahidul Kibria
 
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”Valent Mustamin
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureAlvaro Videla
 
Communication in Python and the C10k problem
Communication in Python and the C10k problemCommunication in Python and the C10k problem
Communication in Python and the C10k problemJose Galarza
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & ScalabilityJoseph Scott
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serializationGWTcon
 
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-NapocaWP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-Napoca4nd4p0p
 

La actualidad más candente (20)

From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Cluster
 
Alternative Infrastucture
Alternative InfrastuctureAlternative Infrastucture
Alternative Infrastucture
 
Phorum MySQL tricks
Phorum MySQL tricksPhorum MySQL tricks
Phorum MySQL tricks
 
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = Awesome
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beers
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and Java
 
HTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS moduleHTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS module
 
Using Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldUsing Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 World
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with java
 
Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)
Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)
Introducing TokuMX: The Performance Engine for MongoDB (NYC.rb 2013-12-10)
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQ
 
Websockets and SockJS, Real time chatting
Websockets and SockJS, Real time chattingWebsockets and SockJS, Real time chatting
Websockets and SockJS, Real time chatting
 
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
High Performance Wordpress: “Faster, Cheaper, Easier : Pick Three”
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
 
Communication in Python and the C10k problem
Communication in Python and the C10k problemCommunication in Python and the C10k problem
Communication in Python and the C10k problem
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
 
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-NapocaWP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
 
Scaling WordPress
Scaling WordPressScaling WordPress
Scaling WordPress
 

Destacado

Admit or Die: Addressing Admission Decision Factors on Websites
Admit or Die: Addressing Admission Decision Factors on Websites Admit or Die: Addressing Admission Decision Factors on Websites
Admit or Die: Addressing Admission Decision Factors on Websites mStoner, Inc.
 
Ejercicios de Propulsión
Ejercicios de PropulsiónEjercicios de Propulsión
Ejercicios de Propulsiónferu
 
Modeling and simulation ch 1
Modeling and simulation ch 1Modeling and simulation ch 1
Modeling and simulation ch 1fika sweety
 
sociale media als didactisch hulpmiddel
sociale media als didactisch hulpmiddelsociale media als didactisch hulpmiddel
sociale media als didactisch hulpmiddelannemiekevanhorssen
 
Sentimiento Medular Ítalo Violo Venezuela 2009
Sentimiento Medular Ítalo Violo Venezuela 2009Sentimiento Medular Ítalo Violo Venezuela 2009
Sentimiento Medular Ítalo Violo Venezuela 2009Italo Violo
 
Skyrocket training company profile
Skyrocket training company profileSkyrocket training company profile
Skyrocket training company profileskyrocket-training
 
La resurrección a través de la pintura. celia martín (6º curso de primaria)
La resurrección a través de la pintura. celia martín (6º curso de primaria)La resurrección a través de la pintura. celia martín (6º curso de primaria)
La resurrección a través de la pintura. celia martín (6º curso de primaria)inmasanza11
 
Ehealth in japan
Ehealth in japanEhealth in japan
Ehealth in japanYasuji Suda
 
Soziale Netzwerke im Versicherungsvertrieb – Digital noch näher am Kunden
Soziale Netzwerke im Versicherungsvertrieb – Digital noch näher am KundenSoziale Netzwerke im Versicherungsvertrieb – Digital noch näher am Kunden
Soziale Netzwerke im Versicherungsvertrieb – Digital noch näher am KundenHenning Meyer
 
Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015
Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015
Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015Eötvös Loránd University
 
iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)
iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)
iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)eye square
 
El teletrabajo y el trabajo a domicilio
El teletrabajo y el trabajo a domicilioEl teletrabajo y el trabajo a domicilio
El teletrabajo y el trabajo a domicilioMilagros Rodriguez
 
Reingeniería de Marca de quesos
Reingeniería de Marca de quesosReingeniería de Marca de quesos
Reingeniería de Marca de quesosDaniel Carpinteyro
 
Pizza Point Of Sale System - SpeedLine Overview
Pizza Point Of Sale System - SpeedLine OverviewPizza Point Of Sale System - SpeedLine Overview
Pizza Point Of Sale System - SpeedLine Overviewcarmensadie
 
Networkvial difunde : El Manual de buenas practicas de seguridad vial
Networkvial difunde : El Manual  de buenas practicas de seguridad vialNetworkvial difunde : El Manual  de buenas practicas de seguridad vial
Networkvial difunde : El Manual de buenas practicas de seguridad vialNETWORKVIAL
 

Destacado (20)

Admit or Die: Addressing Admission Decision Factors on Websites
Admit or Die: Addressing Admission Decision Factors on Websites Admit or Die: Addressing Admission Decision Factors on Websites
Admit or Die: Addressing Admission Decision Factors on Websites
 
Ejercicios de Propulsión
Ejercicios de PropulsiónEjercicios de Propulsión
Ejercicios de Propulsión
 
Modeling and simulation ch 1
Modeling and simulation ch 1Modeling and simulation ch 1
Modeling and simulation ch 1
 
Emos chile
Emos chileEmos chile
Emos chile
 
Tahona caf atenci-n al cliente
Tahona caf    atenci-n al clienteTahona caf    atenci-n al cliente
Tahona caf atenci-n al cliente
 
sociale media als didactisch hulpmiddel
sociale media als didactisch hulpmiddelsociale media als didactisch hulpmiddel
sociale media als didactisch hulpmiddel
 
Sentimiento Medular Ítalo Violo Venezuela 2009
Sentimiento Medular Ítalo Violo Venezuela 2009Sentimiento Medular Ítalo Violo Venezuela 2009
Sentimiento Medular Ítalo Violo Venezuela 2009
 
Skyrocket training company profile
Skyrocket training company profileSkyrocket training company profile
Skyrocket training company profile
 
Working ett present.
Working ett present.Working ett present.
Working ett present.
 
La resurrección a través de la pintura. celia martín (6º curso de primaria)
La resurrección a través de la pintura. celia martín (6º curso de primaria)La resurrección a través de la pintura. celia martín (6º curso de primaria)
La resurrección a través de la pintura. celia martín (6º curso de primaria)
 
Ehealth in japan
Ehealth in japanEhealth in japan
Ehealth in japan
 
Soziale Netzwerke im Versicherungsvertrieb – Digital noch näher am Kunden
Soziale Netzwerke im Versicherungsvertrieb – Digital noch näher am KundenSoziale Netzwerke im Versicherungsvertrieb – Digital noch näher am Kunden
Soziale Netzwerke im Versicherungsvertrieb – Digital noch näher am Kunden
 
Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015
Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015
Eotvos Lorand University (ELTE) services for incoming students spring 2014-2015
 
iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)
iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)
iPhone vs. Samsung Galaxy S II - User Experience Case Study (English)
 
El teletrabajo y el trabajo a domicilio
El teletrabajo y el trabajo a domicilioEl teletrabajo y el trabajo a domicilio
El teletrabajo y el trabajo a domicilio
 
Novocentro Ecomadera UTPL
Novocentro Ecomadera UTPLNovocentro Ecomadera UTPL
Novocentro Ecomadera UTPL
 
Reingeniería de Marca de quesos
Reingeniería de Marca de quesosReingeniería de Marca de quesos
Reingeniería de Marca de quesos
 
Pizza Point Of Sale System - SpeedLine Overview
Pizza Point Of Sale System - SpeedLine OverviewPizza Point Of Sale System - SpeedLine Overview
Pizza Point Of Sale System - SpeedLine Overview
 
Red Tide Phenomenon
Red Tide PhenomenonRed Tide Phenomenon
Red Tide Phenomenon
 
Networkvial difunde : El Manual de buenas practicas de seguridad vial
Networkvial difunde : El Manual  de buenas practicas de seguridad vialNetworkvial difunde : El Manual  de buenas practicas de seguridad vial
Networkvial difunde : El Manual de buenas practicas de seguridad vial
 

Similar a WebSocket

Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJSIsrael Gutiérrez
 
Realtime web experience with signal r
Realtime web experience with signal rRealtime web experience with signal r
Realtime web experience with signal rRan Wahle
 
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysUsing communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysCodemotion Tel Aviv
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Web Real-time Communications
Web Real-time CommunicationsWeb Real-time Communications
Web Real-time CommunicationsAlexei Skachykhin
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajaxSynapseindiappsdevelopment
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebBhagaban Behera
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twistedsdsern
 
Real time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalRReal time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalRRoy Cornelissen
 
Comunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exteriorComunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exteriorRoberto Luis Bisbé
 
Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?timbc
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1nhepner
 
Message in a Bottle
Message in a BottleMessage in a Bottle
Message in a BottleZohar Arad
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008Joe Walker
 
Server-Side Programming Primer
Server-Side Programming PrimerServer-Side Programming Primer
Server-Side Programming PrimerIvano Malavolta
 

Similar a WebSocket (20)

Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJS
 
Realtime web experience with signal r
Realtime web experience with signal rRealtime web experience with signal r
Realtime web experience with signal r
 
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysUsing communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Web Real-time Communications
Web Real-time CommunicationsWeb Real-time Communications
Web Real-time Communications
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajax
 
Building Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 FeaturesBuilding Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 Features
 
Websocket
WebsocketWebsocket
Websocket
 
Lecture 7: Server side programming
Lecture 7: Server side programmingLecture 7: Server side programming
Lecture 7: Server side programming
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twisted
 
Real time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalRReal time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalR
 
Comunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exteriorComunicando nuestras apps con el mundo exterior
Comunicando nuestras apps con el mundo exterior
 
Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?
 
signalr
signalrsignalr
signalr
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1
 
Message in a Bottle
Message in a BottleMessage in a Bottle
Message in a Bottle
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008
 
Intro to Node
Intro to NodeIntro to Node
Intro to Node
 
Server-Side Programming Primer
Server-Side Programming PrimerServer-Side Programming Primer
Server-Side Programming Primer
 

Último

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Último (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

WebSocket

  • 2. Chat on a webpage “Four times.” “Four times.”
  • 3. Chat on a webpage Requirements: • Send messages client→server • Send messages server→client • Detect when client is connected to server (“presence”)
  • 4. Traditional HTTP XMLHttpRequest Long Polling (HTTP from JavaScript) (Long-running XMLHttpRequest) var request = new XMLHttpRequest(); var request = new XMLHttpRequest(); request.open("POST", "/send"); request.open("GET", "/receive"); request.send("Four times."); request.send(); request.onload = function() { appendMessage(this.responseText); startNewRequest(); };
  • 5. Other techniques and problems • Long-polling HTTP requests: XHR, script-tag • Streaming HTTP request: XHR, iframe • Using rtmp with Flash • Misuse of HTTP (proxies, browsers, servers) • Performance (network, httpd cpu) • Not supported in all browsers
  • 6. WebSocket • Full-duplex persistent connection over TCP • Designed by W3C for the web (RFC Dec. ’11) • Uses port 80 • Handshake features HTTP’s “Upgrade”-header • The TLS version passes some HTTP-proxies • Ping/pong frames for staying alive
  • 7. WebSocket JavaScript API var ws = new WebSocket("wss://host"); var ws = new WebSocket("wss://host"); ws.send("Four times."); ws.onmessage = function(event) { ws.send("It has to be."); appendMessage(event.data); };
  • 8. Demo ├── README.md ├── client-sockjs │   ├── chat.js │   └── index.html ├── client-websocket │   ├── chat.js │   └── index.html └── server ├── package.json └── server.js https://github.com/njam/websocket-demo-chat
  • 10. Emulation • WebSocket-like client-API plus server • Enables realtime-comm. in most used browsers • SockJS: Node.js, Erlang, Ruby, Python, .. • Socket.IO: Node.js, Java, Erlang, PHP, ....... • Ratchet: PHP • APE (C), Atmosphere (Java), Tambur.io (WS), Pusher (WS)
  • 11. Server application Integration 1. Same application base: WS-server which reuses your app code Application code Apache WS Server
  • 12. Server application Integration 2. Message Queue / Service API: Messaging between app and WS server (Redis-SockJS push-only broker: cargomedia/socket-redis) Message Queue Application code Broker Apache WS Server