SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
WEB SOCKETS
      CURRENT STATE
   FOR JAVA DEVELOPERS
Web SOCKETS
      CURRENT STATE
   FOR JAVA DEVELOPERS


       PRESENTED
           BY


        VIKTOR
        GAMOV
WEB SOCKETS
                           AGENDA



BIT OF       MEET              WEBSOCKETS       Q&A
HISTORY   THE WEBSOCKETS            IN ACTION   SESSION



                                                 ?
OPTIONS FOR “REALTIME” WEB




  “LEGACY” WEB
      POLLING                           LONG-POLLING                           STEAMING
Browser sends HTTP requests at      Browser sends a request to the
regular intervals and               server and the server keeps the     Browser sends a complete
immediately receives a              request open for a set period       request, but the server sends
response. However, real- time       of time. If a notification is        and maintains an open
data is often not that              received within that period, a      response that is continuously
predictable, making                 response containing the             updated and kept open
unnecessary requests                message is sent to the client. If   indefinitely (or for a set period
inevitable and as a result,         a notification is not received       of time)
many connections are opened         within the set time period, the
and closed needlessly in low-       server sends a response to
message-rate situations             terminate the open request.
WHAT IS WEBSOCKET




“Reducing kilobytes of data to 2 bytes... and reducing latency from 150ms to 50
ms is far more than marginal. In fact, these two factors alone are enough to make
WebSocket seriously interesting...”


                www.ietf.org/mail-archive/web/hybi/current/msg00784.html
WHAT IS WEBSOCKETS?




       WEB SOCKET
STANDARD PROTOCOL              CLIENT-SIDE API         SERVER-SIDE API

 Websocket is a              HTML5 specification       True real-time server
 standardized technology     introduces WebSocket     updates. Expected large
 (described in RFC6455)      client side object. No   penetration in Java
 to support low-overhead     plugin required.         world with upcoming
 bidirectional traffic from                            JavaEE 7 spec and
 your Web browser.                                    JSR-356
WEBSOCKET HANDSHAKE



           To Start full-duplex communication client should send
           UPGRADE request




   1                    2                       3                     4
  SEND                RECEIVE                 CHANGE                LISTEN
UPGRADE             UPGRADE               READYSTATE               MESSAGE
 REQUEST              RESPONSE                TO OPEN                EVENT
DEMO




HANDSHAKE
  DEMO
WEBSOCKET INTERFACE

[Constructor(DOMString	
  url,	
  optional	
  (DOMString	
  or	
  DOMString[])	
  protocols)]
interface	
  WebSocket	
  :	
  EventTarget	
  {
	
  	
  readonly	
  attribute	
  DOMString	
  url;

	
  	
  //	
  ready	
  state
	
  	
  const	
  unsigned	
  short	
  CONNECTING	
  =	
  0;
	
  	
  const	
  unsigned	
  short	
  OPEN	
  =	
  1;
	
  	
  const	
  unsigned	
  short	
  CLOSING	
  =	
  2;
	
  	
  const	
  unsigned	
  short	
  CLOSED	
  =	
  3;
	
  	
  readonly	
  attribute	
  unsigned	
  short	
  readyState;
	
  	
  readonly	
  attribute	
  unsigned	
  long	
  bufferedAmount;

	
  	
  //	
  networking
	
  	
  [TreatNonCallableAsNull]	
  attribute	
  Function?	
  onopen;
	
  	
  [TreatNonCallableAsNull]	
  attribute	
  Function?	
  onerror;
	
  	
  [TreatNonCallableAsNull]	
  attribute	
  Function?	
  onclose;
	
  	
  readonly	
  attribute	
  DOMString	
  extensions;
	
  	
  readonly	
  attribute	
  DOMString	
  protocol;
	
  	
  void	
  close([Clamp]	
  optional	
  unsigned	
  short	
  code,	
  optional	
  DOMString	
  reason);

	
  	
  //	
  messaging
	
  	
  [TreatNonCallableAsNull]	
  attribute	
  Function?	
  onmessage;
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  attribute	
  DOMString	
  binaryType;
	
  	
  void	
  send(DOMString	
  data);
	
  	
  void	
  send(ArrayBufferView	
  data);
	
  	
  void	
  send(Blob	
  data);
};
CLIENT-SIDE WEBSOCKET API

var	
  ws;
if	
  (window.WebSocket)	
  {
	
  	
  	
  	
  output("WebSocket	
  supported	
  in	
  your	
  browser");
	
  	
  	
  	
  ws	
  =	
  new	
  WebSocket("ws://www.websockets.org");

	
  	
  	
  	
  //	
  Set	
  event	
  handlers.
	
  	
  	
  	
  ws.onopen	
  =	
  function	
  ()	
  {
	
  	
  	
  	
  	
  	
  	
  	
  output("onopen");
	
  	
  	
  	
  };
	
  	
  	
  	
  ws.onmessage	
  =	
  function	
  (e)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  //	
  e.data	
  contains	
  received	
  string.
	
  	
  	
  	
  	
  	
  	
  	
  output("echo	
  from	
  server	
  :	
  "	
  +	
  e.data);
	
  	
  	
  	
  };
	
  	
  	
  	
  ws.onclose	
  =	
  function	
  ()	
  {
	
  	
  	
  	
  	
  	
  	
  	
  output("onclose");
	
  	
  	
  	
  };
	
  	
  	
  	
  ws.onerror	
  =	
  function	
  ()	
  {
	
  	
  	
  	
  	
  	
  	
  	
  output("onerror");
	
  	
  	
  	
  };

}
else	
  {output("WebSocket	
  not	
  supported	
  in	
  your	
  browser");}
JAVA EE 7 SERVER-SIDE API



package	
  org.javaee.glassfishwebsocket;

import	
  org.glassfish.websocket.api.annotations.WebSocket;
import	
  org.glassfish.websocket.api.annotations.WebSocketMessage;

@WebSocket(path	
  =	
  "/echo")
public	
  class	
  EchoBean	
  {
	
  	
  	
  	
  @WebSocketMessage
	
  	
  	
  	
  public	
  String	
  echo(String	
  message)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  System.out.println("#####################	
  Message	
  received");
	
  	
  	
  	
  	
  	
  	
  	
  return	
  message	
  +	
  "	
  (from	
  your	
  server)";
	
  	
  	
  	
  }
}
TOMCAT 7.0.29 SERVER-SIDE API




SHOW
  THE
 CODE
Not enough room for code in this slide ;-)
PROGRAMMING WEBSOCKETS




Client-side frameworks

✦jquery.socket.js
 ✦https://github.com/flowersinthesand/jquery-socket/wiki
✦atmosphere.js
  ✦https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-API
✦socket.io
WEBSOCKET SUPPORT



JAVA-based Web servers with native support.
The WebServer has API for WebSocket

✦Netty 3.3.x
✦Jetty 7.x, 8.x
✦Glassfish 3.1.2
✦Tomcat 7.0.27
WHAT SHOULD WE DO?




   WE CAN DO IT!
WHAT IS ATMOSPHERE
Atmosphere
https://github.com/Atmosphere/atmosphere/


✦portable framework for
 ✦long-polling
 ✦Streaming
 ✦Server-Send Events
 ✦WebSockets
✦can auto select best transport
✦abstracting from actual underlying container
mechanism
THINKING ABOUT USE CASES




               ?
USE CASE
                      OUR CLIENTS



WebSockets really shine with following applications:

✦Live trading/sports ticker
✦Controlling medical equipment over the web
✦Chat applications
✦Multiplayer online games
✦Realtime updating social streams
BUNCH OF USEFUL LINKS



✦http://www.w3.org/TR/websockets/ MUST!
✦http://tools.ietf.org/html/rfc6455 MUST!
✦http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html
✦http://websocket-sdk.java.net/Introduction.html
✦https://github.com/Atmosphere/atmosphere/wiki/Supported-
WebServers-and-Browsers
✦http://autobahn.ws/testsuite
Q AND A




Q&A
Put your questions
CONTACT US




             WWW.FARATASYSTEMS.COM

             INFO@FARATASYSTEMS.COM
FIND ME




            TWITTER                 GITHUB
WWW.TWITTER.COM/GAMUSSA             WWW.GITHUB.COM/GAMUSSA
THANK YOU




THANK YOU
      FOR YOUR ATTENTION




 HTTP://WWW.FARATASYSTEMS.COM

Más contenido relacionado

La actualidad más candente

Large scale web socket system with AWS and Web socket
Large scale web socket system with AWS and Web socketLarge scale web socket system with AWS and Web socket
Large scale web socket system with AWS and Web socketLe Kien Truc
 
HTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the WebHTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the WebPeter Lubbers
 
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
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSocketsGunnar Hillert
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)Peter Lubbers
 
Spring + WebSocket integration
Spring + WebSocket integrationSpring + WebSocket integration
Spring + WebSocket integrationOleksandr Semenov
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Arun Gupta
 
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
 
Using WebSockets with ColdFusion
Using WebSockets with ColdFusionUsing WebSockets with ColdFusion
Using WebSockets with ColdFusioncfjedimaster
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with javaJeongHun Byeon
 
Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?Ericom Software
 

La actualidad más candente (20)

Ws
WsWs
Ws
 
Large scale web socket system with AWS and Web socket
Large scale web socket system with AWS and Web socketLarge scale web socket system with AWS and Web socket
Large scale web socket system with AWS and Web socket
 
HTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the WebHTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the Web
 
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
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 
Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
J web socket
J web socketJ web socket
J web socket
 
WebSockets with Spring 4
WebSockets with Spring 4WebSockets with Spring 4
WebSockets with Spring 4
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
Spring + WebSocket integration
Spring + WebSocket integrationSpring + WebSocket integration
Spring + WebSocket integration
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014
 
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
 
Using WebSockets with ColdFusion
Using WebSockets with ColdFusionUsing WebSockets with ColdFusion
Using WebSockets with ColdFusion
 
Php push notifications
Php push notificationsPhp push notifications
Php push notifications
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with java
 
Grizzly 20080925 V2
Grizzly 20080925 V2Grizzly 20080925 V2
Grizzly 20080925 V2
 
Web sockets in Java
Web sockets in JavaWeb sockets in Java
Web sockets in Java
 
WebSocket protocol
WebSocket protocolWebSocket protocol
WebSocket protocol
 
Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?Google Chromebook for the Enterprise: Yeah or Meh?
Google Chromebook for the Enterprise: Yeah or Meh?
 
COMET in Plone
COMET in PloneCOMET in Plone
COMET in Plone
 

Destacado

Functional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAFunctional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAViktor Gamov
 
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»Viktor Gamov
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupViktor Gamov
 
[Jfokus] Riding the Jet Streams
[Jfokus] Riding the Jet Streams[Jfokus] Riding the Jet Streams
[Jfokus] Riding the Jet StreamsViktor Gamov
 
[JokerConf] Верхом на реактивных стримах, 10/13/2016
[JokerConf] Верхом на реактивных стримах, 10/13/2016[JokerConf] Верхом на реактивных стримах, 10/13/2016
[JokerConf] Верхом на реактивных стримах, 10/13/2016Viktor Gamov
 
[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017
[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017
[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017Viktor Gamov
 
[Codemash] Caching Made "Bootiful"!
[Codemash] Caching Made "Bootiful"![Codemash] Caching Made "Bootiful"!
[Codemash] Caching Made "Bootiful"!Viktor Gamov
 
[OracleCode - SF] Distributed caching for your next node.js project
[OracleCode - SF] Distributed caching for your next node.js project[OracleCode - SF] Distributed caching for your next node.js project
[OracleCode - SF] Distributed caching for your next node.js projectViktor Gamov
 
[OracleCode SF] In memory analytics with apache spark and hazelcast
[OracleCode SF] In memory analytics with apache spark and hazelcast[OracleCode SF] In memory analytics with apache spark and hazelcast
[OracleCode SF] In memory analytics with apache spark and hazelcastViktor Gamov
 
Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Baruch Sadogursky
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...Baruch Sadogursky
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]Baruch Sadogursky
 
Spring Data: New approach to persistence
Spring Data: New approach to persistenceSpring Data: New approach to persistence
Spring Data: New approach to persistenceOleksiy Rezchykov
 
Morning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryMorning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryTaras Matyashovsky
 
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and ScalabilityKarthik Babu Sekar
 
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Baruch Sadogursky
 
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootJavaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootIvan Vasyliev
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Baruch Sadogursky
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Baruch Sadogursky
 

Destacado (20)

Functional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAFunctional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIA
 
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user group
 
[Jfokus] Riding the Jet Streams
[Jfokus] Riding the Jet Streams[Jfokus] Riding the Jet Streams
[Jfokus] Riding the Jet Streams
 
[JokerConf] Верхом на реактивных стримах, 10/13/2016
[JokerConf] Верхом на реактивных стримах, 10/13/2016[JokerConf] Верхом на реактивных стримах, 10/13/2016
[JokerConf] Верхом на реактивных стримах, 10/13/2016
 
[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017
[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017
[NYJavaSig] Riding the Distributed Streams - Feb 2nd, 2017
 
[Codemash] Caching Made "Bootiful"!
[Codemash] Caching Made "Bootiful"![Codemash] Caching Made "Bootiful"!
[Codemash] Caching Made "Bootiful"!
 
[OracleCode - SF] Distributed caching for your next node.js project
[OracleCode - SF] Distributed caching for your next node.js project[OracleCode - SF] Distributed caching for your next node.js project
[OracleCode - SF] Distributed caching for your next node.js project
 
[OracleCode SF] In memory analytics with apache spark and hazelcast
[OracleCode SF] In memory analytics with apache spark and hazelcast[OracleCode SF] In memory analytics with apache spark and hazelcast
[OracleCode SF] In memory analytics with apache spark and hazelcast
 
Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
Spring Data: New approach to persistence
Spring Data: New approach to persistenceSpring Data: New approach to persistence
Spring Data: New approach to persistence
 
Morning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryMorning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversary
 
Confession of an Engineer
Confession of an EngineerConfession of an Engineer
Confession of an Engineer
 
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
 
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
 
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootJavaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
 

Similar a WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers

Enhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocketEnhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocketMauricio "Maltron" Leal
 
Real-Time with Flowdock
Real-Time with FlowdockReal-Time with Flowdock
Real-Time with FlowdockFlowdock
 
Web sockets - Pentesting
Web sockets - Pentesting Web sockets - Pentesting
Web sockets - Pentesting Vandana Verma
 
Jwebsocketmobiletechcon2010en 100912071225 Phpapp01
Jwebsocketmobiletechcon2010en 100912071225 Phpapp01Jwebsocketmobiletechcon2010en 100912071225 Phpapp01
Jwebsocketmobiletechcon2010en 100912071225 Phpapp01purans
 
KSDG-iSlide App 開發心得分享
KSDG-iSlide App 開發心得分享KSDG-iSlide App 開發心得分享
KSDG-iSlide App 開發心得分享Chia Wei Tsai
 
WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureFrank Greco
 
Connected Web Systems
Connected Web SystemsConnected Web Systems
Connected Web SystemsDamir Dobric
 
Data power v7 update - Ravi Katikala
Data power v7 update - Ravi KatikalaData power v7 update - Ravi Katikala
Data power v7 update - Ravi Katikalafloridawusergroup
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSocketsGonzalo Ayuso
 
Realizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone BordetRealizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone BordetCodemotion
 
Resilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIsResilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIsVMware Tanzu
 

Similar a WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers (20)

Web-Socket
Web-SocketWeb-Socket
Web-Socket
 
Websocket
WebsocketWebsocket
Websocket
 
Enhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocketEnhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocket
 
Real-Time with Flowdock
Real-Time with FlowdockReal-Time with Flowdock
Real-Time with Flowdock
 
Signal r
Signal rSignal r
Signal r
 
Web sockets - Pentesting
Web sockets - Pentesting Web sockets - Pentesting
Web sockets - Pentesting
 
jWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerry
jWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerryjWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerry
jWebSocket MobileTechCon 2010 - WebSockets on Android, Symbian and BlackBerry
 
Jwebsocketmobiletechcon2010en 100912071225 Phpapp01
Jwebsocketmobiletechcon2010en 100912071225 Phpapp01Jwebsocketmobiletechcon2010en 100912071225 Phpapp01
Jwebsocketmobiletechcon2010en 100912071225 Phpapp01
 
KSDG-iSlide App 開發心得分享
KSDG-iSlide App 開發心得分享KSDG-iSlide App 開發心得分享
KSDG-iSlide App 開發心得分享
 
Ecom 1
Ecom 1Ecom 1
Ecom 1
 
Socket.io
Socket.ioSocket.io
Socket.io
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the Future
 
Connected Web Systems
Connected Web SystemsConnected Web Systems
Connected Web Systems
 
Data power v7 update - Ravi Katikala
Data power v7 update - Ravi KatikalaData power v7 update - Ravi Katikala
Data power v7 update - Ravi Katikala
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 
DevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDKDevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDK
 
Realizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone BordetRealizzare applicazioni Web con WebSocket, by Simone Bordet
Realizzare applicazioni Web con WebSocket, by Simone Bordet
 
Resilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIsResilient and Adaptable Systems with Cloud Native APIs
Resilient and Adaptable Systems with Cloud Native APIs
 

Más de Viktor Gamov

[DataSciCon] Divide, distribute and conquer stream v. batch
[DataSciCon] Divide, distribute and conquer  stream v. batch[DataSciCon] Divide, distribute and conquer  stream v. batch
[DataSciCon] Divide, distribute and conquer stream v. batchViktor Gamov
 
[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch
[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch
[Philly JUG] Divide, Distribute and Conquer: Stream v. BatchViktor Gamov
 
Testing containers with TestContainers @ AJUG 7/18/2017
Testing containers with TestContainers @ AJUG 7/18/2017Testing containers with TestContainers @ AJUG 7/18/2017
Testing containers with TestContainers @ AJUG 7/18/2017Viktor Gamov
 
Distributed caching for your next node.js project cf summit - 06-15-2017
Distributed caching for your next node.js project   cf summit - 06-15-2017Distributed caching for your next node.js project   cf summit - 06-15-2017
Distributed caching for your next node.js project cf summit - 06-15-2017Viktor Gamov
 
[Philly ETE] Java Puzzlers NG
[Philly ETE] Java Puzzlers NG[Philly ETE] Java Puzzlers NG
[Philly ETE] Java Puzzlers NGViktor Gamov
 
Распределяй и властвуй — 2: Потоки данных наносят ответный удар
Распределяй и властвуй — 2: Потоки данных наносят ответный ударРаспределяй и властвуй — 2: Потоки данных наносят ответный удар
Распределяй и властвуй — 2: Потоки данных наносят ответный ударViktor Gamov
 
[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017
[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017
[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017Viktor Gamov
 

Más de Viktor Gamov (7)

[DataSciCon] Divide, distribute and conquer stream v. batch
[DataSciCon] Divide, distribute and conquer  stream v. batch[DataSciCon] Divide, distribute and conquer  stream v. batch
[DataSciCon] Divide, distribute and conquer stream v. batch
 
[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch
[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch
[Philly JUG] Divide, Distribute and Conquer: Stream v. Batch
 
Testing containers with TestContainers @ AJUG 7/18/2017
Testing containers with TestContainers @ AJUG 7/18/2017Testing containers with TestContainers @ AJUG 7/18/2017
Testing containers with TestContainers @ AJUG 7/18/2017
 
Distributed caching for your next node.js project cf summit - 06-15-2017
Distributed caching for your next node.js project   cf summit - 06-15-2017Distributed caching for your next node.js project   cf summit - 06-15-2017
Distributed caching for your next node.js project cf summit - 06-15-2017
 
[Philly ETE] Java Puzzlers NG
[Philly ETE] Java Puzzlers NG[Philly ETE] Java Puzzlers NG
[Philly ETE] Java Puzzlers NG
 
Распределяй и властвуй — 2: Потоки данных наносят ответный удар
Распределяй и властвуй — 2: Потоки данных наносят ответный ударРаспределяй и властвуй — 2: Потоки данных наносят ответный удар
Распределяй и властвуй — 2: Потоки данных наносят ответный удар
 
[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017
[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017
[JBreak] Блеск И Нищета Распределенных Стримов - 04-04-2017
 

Último

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Último (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
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!
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers

  • 1. WEB SOCKETS CURRENT STATE FOR JAVA DEVELOPERS
  • 2. Web SOCKETS CURRENT STATE FOR JAVA DEVELOPERS PRESENTED BY VIKTOR GAMOV
  • 3. WEB SOCKETS AGENDA BIT OF MEET WEBSOCKETS Q&A HISTORY THE WEBSOCKETS IN ACTION SESSION ?
  • 4. OPTIONS FOR “REALTIME” WEB “LEGACY” WEB POLLING LONG-POLLING STEAMING Browser sends HTTP requests at Browser sends a request to the regular intervals and server and the server keeps the Browser sends a complete immediately receives a request open for a set period request, but the server sends response. However, real- time of time. If a notification is and maintains an open data is often not that received within that period, a response that is continuously predictable, making response containing the updated and kept open unnecessary requests message is sent to the client. If indefinitely (or for a set period inevitable and as a result, a notification is not received of time) many connections are opened within the set time period, the and closed needlessly in low- server sends a response to message-rate situations terminate the open request.
  • 5. WHAT IS WEBSOCKET “Reducing kilobytes of data to 2 bytes... and reducing latency from 150ms to 50 ms is far more than marginal. In fact, these two factors alone are enough to make WebSocket seriously interesting...” www.ietf.org/mail-archive/web/hybi/current/msg00784.html
  • 6. WHAT IS WEBSOCKETS? WEB SOCKET STANDARD PROTOCOL CLIENT-SIDE API SERVER-SIDE API Websocket is a HTML5 specification True real-time server standardized technology introduces WebSocket updates. Expected large (described in RFC6455) client side object. No penetration in Java to support low-overhead plugin required. world with upcoming bidirectional traffic from JavaEE 7 spec and your Web browser. JSR-356
  • 7. WEBSOCKET HANDSHAKE To Start full-duplex communication client should send UPGRADE request 1 2 3 4 SEND RECEIVE CHANGE LISTEN UPGRADE UPGRADE READYSTATE MESSAGE REQUEST RESPONSE TO OPEN EVENT
  • 9.
  • 10. WEBSOCKET INTERFACE [Constructor(DOMString  url,  optional  (DOMString  or  DOMString[])  protocols)] interface  WebSocket  :  EventTarget  {    readonly  attribute  DOMString  url;    //  ready  state    const  unsigned  short  CONNECTING  =  0;    const  unsigned  short  OPEN  =  1;    const  unsigned  short  CLOSING  =  2;    const  unsigned  short  CLOSED  =  3;    readonly  attribute  unsigned  short  readyState;    readonly  attribute  unsigned  long  bufferedAmount;    //  networking    [TreatNonCallableAsNull]  attribute  Function?  onopen;    [TreatNonCallableAsNull]  attribute  Function?  onerror;    [TreatNonCallableAsNull]  attribute  Function?  onclose;    readonly  attribute  DOMString  extensions;    readonly  attribute  DOMString  protocol;    void  close([Clamp]  optional  unsigned  short  code,  optional  DOMString  reason);    //  messaging    [TreatNonCallableAsNull]  attribute  Function?  onmessage;                      attribute  DOMString  binaryType;    void  send(DOMString  data);    void  send(ArrayBufferView  data);    void  send(Blob  data); };
  • 11. CLIENT-SIDE WEBSOCKET API var  ws; if  (window.WebSocket)  {        output("WebSocket  supported  in  your  browser");        ws  =  new  WebSocket("ws://www.websockets.org");        //  Set  event  handlers.        ws.onopen  =  function  ()  {                output("onopen");        };        ws.onmessage  =  function  (e)  {                //  e.data  contains  received  string.                output("echo  from  server  :  "  +  e.data);        };        ws.onclose  =  function  ()  {                output("onclose");        };        ws.onerror  =  function  ()  {                output("onerror");        }; } else  {output("WebSocket  not  supported  in  your  browser");}
  • 12. JAVA EE 7 SERVER-SIDE API package  org.javaee.glassfishwebsocket; import  org.glassfish.websocket.api.annotations.WebSocket; import  org.glassfish.websocket.api.annotations.WebSocketMessage; @WebSocket(path  =  "/echo") public  class  EchoBean  {        @WebSocketMessage        public  String  echo(String  message)  {                System.out.println("#####################  Message  received");                return  message  +  "  (from  your  server)";        } }
  • 13. TOMCAT 7.0.29 SERVER-SIDE API SHOW THE CODE Not enough room for code in this slide ;-)
  • 14. PROGRAMMING WEBSOCKETS Client-side frameworks ✦jquery.socket.js ✦https://github.com/flowersinthesand/jquery-socket/wiki ✦atmosphere.js ✦https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-API ✦socket.io
  • 15. WEBSOCKET SUPPORT JAVA-based Web servers with native support. The WebServer has API for WebSocket ✦Netty 3.3.x ✦Jetty 7.x, 8.x ✦Glassfish 3.1.2 ✦Tomcat 7.0.27
  • 16. WHAT SHOULD WE DO? WE CAN DO IT!
  • 17. WHAT IS ATMOSPHERE Atmosphere https://github.com/Atmosphere/atmosphere/ ✦portable framework for ✦long-polling ✦Streaming ✦Server-Send Events ✦WebSockets ✦can auto select best transport ✦abstracting from actual underlying container mechanism
  • 19. USE CASE OUR CLIENTS WebSockets really shine with following applications: ✦Live trading/sports ticker ✦Controlling medical equipment over the web ✦Chat applications ✦Multiplayer online games ✦Realtime updating social streams
  • 20. BUNCH OF USEFUL LINKS ✦http://www.w3.org/TR/websockets/ MUST! ✦http://tools.ietf.org/html/rfc6455 MUST! ✦http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html ✦http://websocket-sdk.java.net/Introduction.html ✦https://github.com/Atmosphere/atmosphere/wiki/Supported- WebServers-and-Browsers ✦http://autobahn.ws/testsuite
  • 21. Q AND A Q&A Put your questions
  • 22. CONTACT US WWW.FARATASYSTEMS.COM INFO@FARATASYSTEMS.COM
  • 23. FIND ME TWITTER GITHUB WWW.TWITTER.COM/GAMUSSA WWW.GITHUB.COM/GAMUSSA
  • 24. THANK YOU THANK YOU FOR YOUR ATTENTION HTTP://WWW.FARATASYSTEMS.COM