SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132
WebSockets: um upgrade
de comunicação no HTML5
Bruno Borges
Oracle Product Manager
Java Evangelist
@brunoborges
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 133
Bruno Borges
Oracle Product Manager / Evangelist
Desenvolvedor, Gamer
Entusiasta em Java Embedded e
JavaFX
Twitter: @brunoborges
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 134
Java EE 7
está pronto!
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 135
Java EE 7 Escopo
●
Produtividade de Desenvolvimento
– Menos código Boilerplate
– Funcionalidades mais ricas
– Mais convenções e defaults
●
Suporte a HTML5
– WebSocket
– JSON
– HTML5 Forms
JSR 342
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 136
Java EE 7
EJB 3.2
Servlet 3.1
CDI
Extensio
ns
Batch 1.0
Web
Fragment
s
JCA 1.7JMS 2.0JPA 2.1
Managed Beans 1.0
Concurrency 1.0
Common
Annotations 1.1
Interceptors
1.2, JTA 1.2
CDI 1.1
JSF 2.2,
JSP 2.3,
EL 3.0
JAX-RS 2.0,
JAX-WS 2.2
JSON 1.0
WebSock
et 1.0
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 137
Construindo aplicações HTML5
com WebSockets
 Java API WebSocket 1.0 – JSR 356
 RFC 6455
 W3C Web Sockets API
– JavaScript objects
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 138
HTTP vs WebSockets
 Protocolo HTTP é half-duplex
 Gambiarras
– Polling
– Long polling
– Streaming
 WebSocket resolve o problema
de uma vez por todas
– Full-duplex
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 139
WebSockets Handshake
 Cliente solicita um UPGRADE
 Server confirma (Servlet 3.1)
 Cliente recebe o OK
 Inicia a sessão WebSocket
http://farata.github.io/slidedecks/state_of_websocket/slides.html#13.4
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1310
WebSockets API for Javascript
var ws;
if (window.WebSocket) {
ws = new WebSocket("ws://echo.websocket.org");
ws.onopen = function () {
console.log("onopen");
};
ws.onmessage = function (e) {
// e.data contains received string.
console.log("echo from server : " + e.data);
};
ws.onclose = function () { console.log("onclose"); };
ws.onerror = function () { console.log("onerror"); };
} else {
console.log("WebSocket not supported in your browser");
}
if (ws.readyState === 1) ws.send("Hello WebSocket!");
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1311
WebSockets Facts
 WS não funciona por proxies
 Suporte incompleto em browsers
 Desafios de configurar WebSocket com LBRs
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1312
WebSockets e Browsers
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1313
WebSockets só roda em navegadores Web?
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1314
Clientes além de Navegadores
 iOS
– SocketRocket
 Android
– Async HTTP Client
– AutobahnAndroid
 Java libs and JavaFX
– WebView HTML5 component
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1315
Ping Pong
 Serve para manter a conexão ativa
 Programaticamente possível interceptar
– Server
– Client
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1316
Java API for WebSockets 1.0
 API para definir WebSockets, tanto Client como Server
– Annotation-driven (@ServerEndpoint)
– Interface-driven (Endpoint)
– Client (@ClientEndpoint)
 SPI para data frames
– Negociação handshake na abertura do WebSocket
 Integração com o Java EE Web container
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1317
Java API for WebSockets 1.0
import javax.websocket.*;
import javax.websocket.server.*;
@ServerEndpoint(“/hello”)
public class HelloBean {
    @OnMessage
    public String sayHello(String name) {
        return “Hello “ + name;
    }
}
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1318
Java API for WebSockets 1.0
@ServerEndpoint(“/chat”)
public class ChatBean {
    @OnOpen
    public void onOpen(Session peer) {
        peers.add(peer);
    }
    @OnClose
    public void onClose(Session peer) {
        peers.remove(peer);
    }
    @OnMessage
    public void message(String msg, Session client) {
        peers.forEach(p ­> p.getRemote().sendMessage(msg));
    }
}
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1319
DEMO
WebSockets
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1320
Casos de Uso para WebSockets
 Placar de jogos
 Controlar equipamentos pela Web
 Chat
 MMORPG
 Atualização de Social Streams em tempo real
 Ferramentas em geral com auto refresh
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1321
Perguntas?
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1322
Créditos: Fara Systems
 Conteúdo de WebSockets extraído de:
farata.github.io/slidedecks/state_of_websocket/slides.html#1.0
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1323
OBRIGADO!
@brunoborges
blogs.oracle.com/brunoborges
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1324
The preceding is intended to outline our general product direction. It is intended
for information purposes only, and may not be incorporated into any contract.
It is not a commitment to deliver any material, code, or functionality, and should
not be relied upon in making purchasing decisions. The development, release,
and timing of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1325

Mais conteúdo relacionado

Mais procurados

SafePeak Installation guide
SafePeak Installation guideSafePeak Installation guide
SafePeak Installation guideVladi Vexler
 
Esm rel notes_6.0cp1
Esm rel notes_6.0cp1Esm rel notes_6.0cp1
Esm rel notes_6.0cp1Protect724v3
 
ESM 5.5 Patch 1 Release Notes
ESM 5.5 Patch 1 Release NotesESM 5.5 Patch 1 Release Notes
ESM 5.5 Patch 1 Release NotesProtect724
 
July Patch Tuesday 2020
July Patch Tuesday 2020July Patch Tuesday 2020
July Patch Tuesday 2020Dan Lalli
 
ESM 6.8c Patch 2 Release Notes
ESM 6.8c Patch 2 Release NotesESM 6.8c Patch 2 Release Notes
ESM 6.8c Patch 2 Release NotesProtect724v3
 
Wowza mediaserver usersguide
Wowza mediaserver usersguideWowza mediaserver usersguide
Wowza mediaserver usersguider00tsecurity
 
Performance tuning how to write and run correctly sql statement
Performance tuning how to write and run correctly sql statementPerformance tuning how to write and run correctly sql statement
Performance tuning how to write and run correctly sql statementRonald Francisco Vargas Quesada
 
Sh404sef, Urls, Seo And More
Sh404sef, Urls, Seo And MoreSh404sef, Urls, Seo And More
Sh404sef, Urls, Seo And MoreYannick Gaultier
 

Mais procurados (11)

SafePeak Installation guide
SafePeak Installation guideSafePeak Installation guide
SafePeak Installation guide
 
Esm rel notes_6.0cp1
Esm rel notes_6.0cp1Esm rel notes_6.0cp1
Esm rel notes_6.0cp1
 
Javaeetutorial6
Javaeetutorial6Javaeetutorial6
Javaeetutorial6
 
ESM 5.5 Patch 1 Release Notes
ESM 5.5 Patch 1 Release NotesESM 5.5 Patch 1 Release Notes
ESM 5.5 Patch 1 Release Notes
 
jfx
jfxjfx
jfx
 
July Patch Tuesday 2020
July Patch Tuesday 2020July Patch Tuesday 2020
July Patch Tuesday 2020
 
E10132
E10132E10132
E10132
 
ESM 6.8c Patch 2 Release Notes
ESM 6.8c Patch 2 Release NotesESM 6.8c Patch 2 Release Notes
ESM 6.8c Patch 2 Release Notes
 
Wowza mediaserver usersguide
Wowza mediaserver usersguideWowza mediaserver usersguide
Wowza mediaserver usersguide
 
Performance tuning how to write and run correctly sql statement
Performance tuning how to write and run correctly sql statementPerformance tuning how to write and run correctly sql statement
Performance tuning how to write and run correctly sql statement
 
Sh404sef, Urls, Seo And More
Sh404sef, Urls, Seo And MoreSh404sef, Urls, Seo And More
Sh404sef, Urls, Seo And More
 

Semelhante a WebSockets: um upgrade de comunicação no HTML5

Aplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansAplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansBruno Borges
 
As novidades do Java EE 7: do HTML5 ao JMS 2.0
As novidades do Java EE 7: do HTML5 ao JMS 2.0As novidades do Java EE 7: do HTML5 ao JMS 2.0
As novidades do Java EE 7: do HTML5 ao JMS 2.0Bruno Borges
 
Java EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e MudançasJava EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e MudançasBruno Borges
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishArun Gupta
 
Introduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiIntroduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiBruno Borges
 
A Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado EmbeddedA Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado EmbeddedBruno Borges
 
JavaFX and JEE 7
JavaFX and JEE 7JavaFX and JEE 7
JavaFX and JEE 7Vijay Nair
 
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)Shing Wai Chan
 
whats-new-netbeans-ide-80.pptx
whats-new-netbeans-ide-80.pptxwhats-new-netbeans-ide-80.pptx
whats-new-netbeans-ide-80.pptxGabrielSoche
 
Architecture performance and tips and tricks for instantis enterprise track 8...
Architecture performance and tips and tricks for instantis enterprise track 8...Architecture performance and tips and tricks for instantis enterprise track 8...
Architecture performance and tips and tricks for instantis enterprise track 8...p6academy
 
Oracle Plug-in For Open ModelSphere
Oracle Plug-in For Open ModelSphereOracle Plug-in For Open ModelSphere
Oracle Plug-in For Open ModelSpheremodelspherepro
 
Novidades do Java SE 8
Novidades do Java SE 8Novidades do Java SE 8
Novidades do Java SE 8Bruno Borges
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Edward Burns
 
How Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentHow Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentBruno Borges
 
Java Web Application Security - Denver JUG 2013
Java Web Application Security - Denver JUG 2013Java Web Application Security - Denver JUG 2013
Java Web Application Security - Denver JUG 2013Matt Raible
 
206520 p6 web services programming interface
206520 p6 web services programming interface206520 p6 web services programming interface
206520 p6 web services programming interfacep6academy
 
MySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de GamesMySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de GamesMySQL Brasil
 

Semelhante a WebSockets: um upgrade de comunicação no HTML5 (20)

Aplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansAplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeans
 
As novidades do Java EE 7: do HTML5 ao JMS 2.0
As novidades do Java EE 7: do HTML5 ao JMS 2.0As novidades do Java EE 7: do HTML5 ao JMS 2.0
As novidades do Java EE 7: do HTML5 ao JMS 2.0
 
Java EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e MudançasJava EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e Mudanças
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFish
 
Introduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiIntroduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry Pi
 
A Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado EmbeddedA Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado Embedded
 
JavaFX and JEE 7
JavaFX and JEE 7JavaFX and JEE 7
JavaFX and JEE 7
 
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
 
Con5133
Con5133Con5133
Con5133
 
whats-new-netbeans-ide-80.pptx
whats-new-netbeans-ide-80.pptxwhats-new-netbeans-ide-80.pptx
whats-new-netbeans-ide-80.pptx
 
Architecture performance and tips and tricks for instantis enterprise track 8...
Architecture performance and tips and tricks for instantis enterprise track 8...Architecture performance and tips and tricks for instantis enterprise track 8...
Architecture performance and tips and tricks for instantis enterprise track 8...
 
Oracle Plug-in For Open ModelSphere
Oracle Plug-in For Open ModelSphereOracle Plug-in For Open ModelSphere
Oracle Plug-in For Open ModelSphere
 
HTML5 Comprehensive Guide
HTML5 Comprehensive GuideHTML5 Comprehensive Guide
HTML5 Comprehensive Guide
 
Novidades do Java SE 8
Novidades do Java SE 8Novidades do Java SE 8
Novidades do Java SE 8
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
 
How Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentHow Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web Development
 
Java Web Application Security - Denver JUG 2013
Java Web Application Security - Denver JUG 2013Java Web Application Security - Denver JUG 2013
Java Web Application Security - Denver JUG 2013
 
206520 p6 web services programming interface
206520 p6 web services programming interface206520 p6 web services programming interface
206520 p6 web services programming interface
 
MySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de GamesMySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de Games
 

Mais de Bruno Borges

Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesBruno Borges
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on KubernetesBruno Borges
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsFrom GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsBruno Borges
 
Making Sense of Serverless Computing
Making Sense of Serverless ComputingMaking Sense of Serverless Computing
Making Sense of Serverless ComputingBruno Borges
 
Visual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring DevelopersVisual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring DevelopersBruno Borges
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudTaking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudBruno Borges
 
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...Bruno Borges
 
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na NuvemMelhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na NuvemBruno Borges
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemBruno Borges
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudBruno Borges
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXBruno Borges
 
Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?Bruno Borges
 
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]Bruno Borges
 
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]Bruno Borges
 
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]Bruno Borges
 
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]Bruno Borges
 
Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]Bruno Borges
 
Lightweight Java in the Cloud
Lightweight Java in the CloudLightweight Java in the Cloud
Lightweight Java in the CloudBruno Borges
 
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFXTweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFXBruno Borges
 
Integrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSocketsIntegrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSocketsBruno Borges
 

Mais de Bruno Borges (20)

Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsFrom GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
 
Making Sense of Serverless Computing
Making Sense of Serverless ComputingMaking Sense of Serverless Computing
Making Sense of Serverless Computing
 
Visual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring DevelopersVisual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring Developers
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudTaking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure Cloud
 
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
 
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na NuvemMelhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na Nuvem
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The Cloud
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFX
 
Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?
 
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
 
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
 
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
 
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
 
Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]
 
Lightweight Java in the Cloud
Lightweight Java in the CloudLightweight Java in the Cloud
Lightweight Java in the Cloud
 
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFXTweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
 
Integrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSocketsIntegrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSockets
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

WebSockets: um upgrade de comunicação no HTML5

  • 1. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132 WebSockets: um upgrade de comunicação no HTML5 Bruno Borges Oracle Product Manager Java Evangelist @brunoborges
  • 2. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 133 Bruno Borges Oracle Product Manager / Evangelist Desenvolvedor, Gamer Entusiasta em Java Embedded e JavaFX Twitter: @brunoborges
  • 3. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 134 Java EE 7 está pronto!
  • 4. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 135 Java EE 7 Escopo ● Produtividade de Desenvolvimento – Menos código Boilerplate – Funcionalidades mais ricas – Mais convenções e defaults ● Suporte a HTML5 – WebSocket – JSON – HTML5 Forms JSR 342
  • 5. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 136 Java EE 7 EJB 3.2 Servlet 3.1 CDI Extensio ns Batch 1.0 Web Fragment s JCA 1.7JMS 2.0JPA 2.1 Managed Beans 1.0 Concurrency 1.0 Common Annotations 1.1 Interceptors 1.2, JTA 1.2 CDI 1.1 JSF 2.2, JSP 2.3, EL 3.0 JAX-RS 2.0, JAX-WS 2.2 JSON 1.0 WebSock et 1.0
  • 6. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 137 Construindo aplicações HTML5 com WebSockets  Java API WebSocket 1.0 – JSR 356  RFC 6455  W3C Web Sockets API – JavaScript objects
  • 7. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 138 HTTP vs WebSockets  Protocolo HTTP é half-duplex  Gambiarras – Polling – Long polling – Streaming  WebSocket resolve o problema de uma vez por todas – Full-duplex
  • 8. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 139 WebSockets Handshake  Cliente solicita um UPGRADE  Server confirma (Servlet 3.1)  Cliente recebe o OK  Inicia a sessão WebSocket http://farata.github.io/slidedecks/state_of_websocket/slides.html#13.4
  • 9. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1310 WebSockets API for Javascript var ws; if (window.WebSocket) { ws = new WebSocket("ws://echo.websocket.org"); ws.onopen = function () { console.log("onopen"); }; ws.onmessage = function (e) { // e.data contains received string. console.log("echo from server : " + e.data); }; ws.onclose = function () { console.log("onclose"); }; ws.onerror = function () { console.log("onerror"); }; } else { console.log("WebSocket not supported in your browser"); } if (ws.readyState === 1) ws.send("Hello WebSocket!");
  • 10. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1311 WebSockets Facts  WS não funciona por proxies  Suporte incompleto em browsers  Desafios de configurar WebSocket com LBRs
  • 11. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1312 WebSockets e Browsers
  • 12. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1313 WebSockets só roda em navegadores Web?
  • 13. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1314 Clientes além de Navegadores  iOS – SocketRocket  Android – Async HTTP Client – AutobahnAndroid  Java libs and JavaFX – WebView HTML5 component
  • 14. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1315 Ping Pong  Serve para manter a conexão ativa  Programaticamente possível interceptar – Server – Client
  • 15. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1316 Java API for WebSockets 1.0  API para definir WebSockets, tanto Client como Server – Annotation-driven (@ServerEndpoint) – Interface-driven (Endpoint) – Client (@ClientEndpoint)  SPI para data frames – Negociação handshake na abertura do WebSocket  Integração com o Java EE Web container
  • 16. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1317 Java API for WebSockets 1.0 import javax.websocket.*; import javax.websocket.server.*; @ServerEndpoint(“/hello”) public class HelloBean {     @OnMessage     public String sayHello(String name) {         return “Hello “ + name;     } }
  • 17. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1318 Java API for WebSockets 1.0 @ServerEndpoint(“/chat”) public class ChatBean {     @OnOpen     public void onOpen(Session peer) {         peers.add(peer);     }     @OnClose     public void onClose(Session peer) {         peers.remove(peer);     }     @OnMessage     public void message(String msg, Session client) {         peers.forEach(p ­> p.getRemote().sendMessage(msg));     } }
  • 18. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1319 DEMO WebSockets
  • 19. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1320 Casos de Uso para WebSockets  Placar de jogos  Controlar equipamentos pela Web  Chat  MMORPG  Atualização de Social Streams em tempo real  Ferramentas em geral com auto refresh
  • 20. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1321 Perguntas?
  • 21. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1322 Créditos: Fara Systems  Conteúdo de WebSockets extraído de: farata.github.io/slidedecks/state_of_websocket/slides.html#1.0
  • 22. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1323 OBRIGADO! @brunoborges blogs.oracle.com/brunoborges
  • 23. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1324 The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 24. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1325