SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Kürzlich hochgeladen (20)

Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

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