SlideShare une entreprise Scribd logo
1  sur  16
Java User Group Louvain-La-Neuve 
9/10/2014 – EPHEC LLN 
Rudy Vissers 
Coding Java WebSocket Applications 
Using the JSR 356 API
Introduction 
● HTTP(Hypertext Transfer Protocol) is a 
stateless request-response protocol. 
● This simple design of the HTTP protocol 
makes it very scalable but inefficient and 
unsuitable for highly interactive real-time web 
applications : Chat applications, Multiplayer 
games, etc. 
● HTTP was designed for document sharing 
and not for building today’s highly 
interactive web applications. 
● HTTP is bit chatty in nature,
Introduction cont. 
● Before the HTTP 1.1 version, every request 
made to the server resulted in a new 
connection. 
● This was improved in HTTP 1.1 with the 
introduction of HTTP persistence connections. 
● Persistent connections allowed web browsers 
to reuse the same connection for fetching 
images, scripts, etc.
Introduction cont. 
● HTTP was designed to be half-duplex which 
means it allows transmission of data in just one 
direction at a time. 
● A Walkie-talkie is an example of a half 
duplex device because only one person can 
speak at a time. 
● Developers have created some workarounds or 
hacks to overcome this HTTP shortcoming : 
polling, long polling, and streaming.
Introduction cont. 
● With polling, the client makes synchronous 
calls to get information from the server. Do you 
have something for me ? 
● If the server has new information available it will 
send back data in the response. 
● Otherwise, no information will be sent to the 
client and the client will again make a new 
connection after sometime. 
● This is very inefficient but a very simple way 
to achieve real-time behavior.
What is a WebSocket? 
● A WebSocket is asynchronous, bidirectional, 
full-duplex messaging implementation over a 
single TCP connection. 
● WebSockets are not a HTTP connection , but 
use HTTP to bootstrap a WebSocket 
connection. 
● A full-duplex system allows communication in 
both directions simultaneously. 
● Telephones lines are an example of a full-duplex 
device, since they allow both callers to 
speak and be heard at the same time.
What is a WebSocket? cont. 
● RFC 6455 : 
The WebSocket Protocol : 
http://tools.ietf.org/html/rfc6455 
● JSR 356 : 
Java API for WebSocket : 
https://jcp.org/en/jsr/detail?id=356 
● WebSocket JavaScript API : 
http://www.w3.org/TR/2011/WD-websockets- 
20110419
Browsers : can I use ? 
● WebSockets are supported by all the latest 
browsers.
How Does a WebSocket Work? 
● Every WebSocket connection begins its life as 
an HTTP request. 
● The HTTP request is much like another 
request, except that it has an Upgrade header. 
● The Upgrade header indicates that a client 
would like to upgrade the connection to 
different protocol(s). 
● For WebSockets it will upgrade to the 
WebSocket protocol. 
● The WebSocket connection is established by 
upgrading from HTTP protocol to the
WebSocket is more complex than 
HTTP 
● You can establish an HTTP connection with a 
telnet client, telnet localhost 80 :-) 
but you probably cannot do the same with WS. 
● Even if you ignored the handshake 
requirements (which include the use of the 
SHA1 hash function), you would then be unable 
to properly mask and frame the data to be sent 
and the server would close the connection.
WebSocket is more complex than 
HTTP cont. 
● WebSocket connections are intended to be 
more persistent than HTTP connections. 
● If you only want to receive an update every 30 
minutes, you will want to go with HTTP. 
● If you want to receive updates every second, a 
WebSocket might be a better option, because 
establishing an HTTP connection takes a lot 
of time.
WebSockets simplify real-time 
application architectures 
● For these kind of applications WebSockets are 
more efficient and performant than other 
workarounds like polling. 
● They require less bandwidth and reduce 
latency. 
● WebSockets do not require headers to send 
messages between peers. 
● This considerably lowers the required 
bandwidth.
WebSocket Use Cases 
● Chat applications 
● Multiplayer games 
● Stock trading or financial applications 
● Collaborative document editing 
● Social networking applications
Java APIs 
● JSR 356, Java API for WebSocket, specifies 
Java API that developers can use to integrate 
WebSockets into their applications both on the 
server side as well as on the Java client side. 
● JSR 356 is part of the upcoming Java EE 7 
standard. 
● This means all Java EE 7 compliant application 
servers will have an implementation of the 
WebSocket protocol that adheres to the JSR 
356 standard. 
● Developers can also use JSR 356 outside Java
Java APIs cont. 
● A Java client can use JSR 356 compliant client 
implementation to connect to a WebSocket 
server (Tyrus). 
● For web clients, developers can use 
WebSocket JavaScript API to communicate 
with WebSocket server. 
● The difference between a WebSocket client 
and a WebSocket server lies only in the means 
by which the two are connected. 
● A WebSocket client is a WebSocket endpoint 
that initiates a connection to a peer.
● Time to code !

Contenu connexe

Tendances

PMTA Success Story - J2 Martech
PMTA Success Story - J2 MartechPMTA Success Story - J2 Martech
PMTA Success Story - J2 MartechSparkPost
 
Zing Me Real Time Web Chat Architect
Zing Me Real Time Web Chat ArchitectZing Me Real Time Web Chat Architect
Zing Me Real Time Web Chat ArchitectChau Thanh
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? Sigma Software
 
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes DownDebugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes DownAspen Mesh
 
Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Ulf Lilleengen
 
Web performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transitionWeb performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transitionseanwalbran
 
Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web DevelopmentGLC Networks
 
Systems management - UltraESB
Systems management - UltraESBSystems management - UltraESB
Systems management - UltraESBAdroitLogic
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performaceTuyển Đoàn
 
Connection load balancing with mikrotik [workshop]
Connection load balancing with mikrotik [workshop]Connection load balancing with mikrotik [workshop]
Connection load balancing with mikrotik [workshop]Achmad Mardiansyah
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serializationGWTcon
 
System Configuration for UltraESB
System Configuration for UltraESBSystem Configuration for UltraESB
System Configuration for UltraESBAdroitLogic
 

Tendances (20)

gRPC Overview
gRPC OverviewgRPC Overview
gRPC Overview
 
PMTA Success Story - J2 Martech
PMTA Success Story - J2 MartechPMTA Success Story - J2 Martech
PMTA Success Story - J2 Martech
 
Web Sockets - HTML5
Web Sockets - HTML5Web Sockets - HTML5
Web Sockets - HTML5
 
HTTP/2
HTTP/2HTTP/2
HTTP/2
 
Zing Me Real Time Web Chat Architect
Zing Me Real Time Web Chat ArchitectZing Me Real Time Web Chat Architect
Zing Me Real Time Web Chat Architect
 
Pune Ruby Meetup - November 2015
Pune Ruby Meetup - November 2015Pune Ruby Meetup - November 2015
Pune Ruby Meetup - November 2015
 
Building microservices with grpc
Building microservices with grpcBuilding microservices with grpc
Building microservices with grpc
 
Internet protocol
Internet protocolInternet protocol
Internet protocol
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know?
 
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes DownDebugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
Debugging Your Debugging Tools: What to do When Your Service Mesh Goes Down
 
Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017
 
Web performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transitionWeb performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transition
 
Http 2
Http 2Http 2
Http 2
 
Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web Development
 
Systems management - UltraESB
Systems management - UltraESBSystems management - UltraESB
Systems management - UltraESB
 
Php & web server performace
Php & web server performacePhp & web server performace
Php & web server performace
 
Connection load balancing with mikrotik [workshop]
Connection load balancing with mikrotik [workshop]Connection load balancing with mikrotik [workshop]
Connection load balancing with mikrotik [workshop]
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
 
System Configuration for UltraESB
System Configuration for UltraESBSystem Configuration for UltraESB
System Configuration for UltraESB
 

Similaire à JUG louvain websockets

Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsNaresh Chintalcheru
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stackLuca Mattia Ferrari
 
Understanding Akka WebSockets A Comprehensive Guide.pptx
Understanding Akka WebSockets A Comprehensive Guide.pptxUnderstanding Akka WebSockets A Comprehensive Guide.pptx
Understanding Akka WebSockets A Comprehensive Guide.pptxKnoldus Inc.
 
Understanding Akka WebSockets A Comprehensive Guide
Understanding Akka WebSockets A Comprehensive GuideUnderstanding Akka WebSockets A Comprehensive Guide
Understanding Akka WebSockets A Comprehensive GuideKnoldus Inc.
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...WebStackAcademy
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...Edward Burns
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
Webinar: Draw a line between HTTP/2 client and HTTP Client
Webinar: Draw a line between HTTP/2 client and HTTP ClientWebinar: Draw a line between HTTP/2 client and HTTP Client
Webinar: Draw a line between HTTP/2 client and HTTP ClientKnoldus Inc.
 
Decoding real time web communication
Decoding real time web communicationDecoding real time web communication
Decoding real time web communicationAMiT JAiN
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET Journal
 
WebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceWebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceRick Hightower
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocolsDaniel Austin
 

Similaire à JUG louvain websockets (20)

Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stack
 
Understanding Akka WebSockets A Comprehensive Guide.pptx
Understanding Akka WebSockets A Comprehensive Guide.pptxUnderstanding Akka WebSockets A Comprehensive Guide.pptx
Understanding Akka WebSockets A Comprehensive Guide.pptx
 
Understanding Akka WebSockets A Comprehensive Guide
Understanding Akka WebSockets A Comprehensive GuideUnderstanding Akka WebSockets A Comprehensive Guide
Understanding Akka WebSockets A Comprehensive Guide
 
ClientServer Websocket.pptx
ClientServer Websocket.pptxClientServer Websocket.pptx
ClientServer Websocket.pptx
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 
Web socket with php v2
Web socket with php v2Web socket with php v2
Web socket with php v2
 
Web-Socket
Web-SocketWeb-Socket
Web-Socket
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
KrakenD API Gateway
KrakenD API GatewayKrakenD API Gateway
KrakenD API Gateway
 
Monkey Server
Monkey ServerMonkey Server
Monkey Server
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
WebRCT
WebRCTWebRCT
WebRCT
 
Webinar: Draw a line between HTTP/2 client and HTTP Client
Webinar: Draw a line between HTTP/2 client and HTTP ClientWebinar: Draw a line between HTTP/2 client and HTTP Client
Webinar: Draw a line between HTTP/2 client and HTTP Client
 
Decoding real time web communication
Decoding real time web communicationDecoding real time web communication
Decoding real time web communication
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
WebRTC Seminar Report
WebRTC  Seminar ReportWebRTC  Seminar Report
WebRTC Seminar Report
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
 
WebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceWebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST Microservice
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 

Dernier

办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 

Dernier (20)

办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 

JUG louvain websockets

  • 1. Java User Group Louvain-La-Neuve 9/10/2014 – EPHEC LLN Rudy Vissers Coding Java WebSocket Applications Using the JSR 356 API
  • 2. Introduction ● HTTP(Hypertext Transfer Protocol) is a stateless request-response protocol. ● This simple design of the HTTP protocol makes it very scalable but inefficient and unsuitable for highly interactive real-time web applications : Chat applications, Multiplayer games, etc. ● HTTP was designed for document sharing and not for building today’s highly interactive web applications. ● HTTP is bit chatty in nature,
  • 3. Introduction cont. ● Before the HTTP 1.1 version, every request made to the server resulted in a new connection. ● This was improved in HTTP 1.1 with the introduction of HTTP persistence connections. ● Persistent connections allowed web browsers to reuse the same connection for fetching images, scripts, etc.
  • 4. Introduction cont. ● HTTP was designed to be half-duplex which means it allows transmission of data in just one direction at a time. ● A Walkie-talkie is an example of a half duplex device because only one person can speak at a time. ● Developers have created some workarounds or hacks to overcome this HTTP shortcoming : polling, long polling, and streaming.
  • 5. Introduction cont. ● With polling, the client makes synchronous calls to get information from the server. Do you have something for me ? ● If the server has new information available it will send back data in the response. ● Otherwise, no information will be sent to the client and the client will again make a new connection after sometime. ● This is very inefficient but a very simple way to achieve real-time behavior.
  • 6. What is a WebSocket? ● A WebSocket is asynchronous, bidirectional, full-duplex messaging implementation over a single TCP connection. ● WebSockets are not a HTTP connection , but use HTTP to bootstrap a WebSocket connection. ● A full-duplex system allows communication in both directions simultaneously. ● Telephones lines are an example of a full-duplex device, since they allow both callers to speak and be heard at the same time.
  • 7. What is a WebSocket? cont. ● RFC 6455 : The WebSocket Protocol : http://tools.ietf.org/html/rfc6455 ● JSR 356 : Java API for WebSocket : https://jcp.org/en/jsr/detail?id=356 ● WebSocket JavaScript API : http://www.w3.org/TR/2011/WD-websockets- 20110419
  • 8. Browsers : can I use ? ● WebSockets are supported by all the latest browsers.
  • 9. How Does a WebSocket Work? ● Every WebSocket connection begins its life as an HTTP request. ● The HTTP request is much like another request, except that it has an Upgrade header. ● The Upgrade header indicates that a client would like to upgrade the connection to different protocol(s). ● For WebSockets it will upgrade to the WebSocket protocol. ● The WebSocket connection is established by upgrading from HTTP protocol to the
  • 10. WebSocket is more complex than HTTP ● You can establish an HTTP connection with a telnet client, telnet localhost 80 :-) but you probably cannot do the same with WS. ● Even if you ignored the handshake requirements (which include the use of the SHA1 hash function), you would then be unable to properly mask and frame the data to be sent and the server would close the connection.
  • 11. WebSocket is more complex than HTTP cont. ● WebSocket connections are intended to be more persistent than HTTP connections. ● If you only want to receive an update every 30 minutes, you will want to go with HTTP. ● If you want to receive updates every second, a WebSocket might be a better option, because establishing an HTTP connection takes a lot of time.
  • 12. WebSockets simplify real-time application architectures ● For these kind of applications WebSockets are more efficient and performant than other workarounds like polling. ● They require less bandwidth and reduce latency. ● WebSockets do not require headers to send messages between peers. ● This considerably lowers the required bandwidth.
  • 13. WebSocket Use Cases ● Chat applications ● Multiplayer games ● Stock trading or financial applications ● Collaborative document editing ● Social networking applications
  • 14. Java APIs ● JSR 356, Java API for WebSocket, specifies Java API that developers can use to integrate WebSockets into their applications both on the server side as well as on the Java client side. ● JSR 356 is part of the upcoming Java EE 7 standard. ● This means all Java EE 7 compliant application servers will have an implementation of the WebSocket protocol that adheres to the JSR 356 standard. ● Developers can also use JSR 356 outside Java
  • 15. Java APIs cont. ● A Java client can use JSR 356 compliant client implementation to connect to a WebSocket server (Tyrus). ● For web clients, developers can use WebSocket JavaScript API to communicate with WebSocket server. ● The difference between a WebSocket client and a WebSocket server lies only in the means by which the two are connected. ● A WebSocket client is a WebSocket endpoint that initiates a connection to a peer.
  • 16. ● Time to code !