SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
WebSocket 
API.NEXT 
Pavel 
Bucek 
(pavel.bucek@oracle.com) 
Oracle 
September 
29, 
2014 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Safe 
Harbor 
Statement 
The 
following 
is 
intended 
to 
outline 
our 
general 
product 
direcSon. 
It 
is 
intended 
for 
informaSon 
purposes 
only, 
and 
may 
not 
be 
incorporated 
into 
any 
contract. 
It 
is 
not 
a 
commitment 
to 
deliver 
any 
material, 
code, 
or 
funcSonality, 
and 
should 
not 
be 
relied 
upon 
in 
making 
purchasing 
decisions. 
The 
development, 
release, 
and 
Sming 
of 
any 
features 
or 
funcSonality 
described 
for 
Oracle’s 
products 
remains 
at 
the 
sole 
discreSon 
of 
Oracle. 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Program 
Agenda 
Short 
intro 
about 
JSR 
356 
– 
Java 
API 
for 
WebSocket 
WebSocket 
API 
1.1 
WebSocket.NEXT 
CDI, 
Frame 
API, 
Extensions, 
SubProtocols, 
Java 
EE 
integraSon, 
Client 
API 
enhancements, 
smaller 
issues 
(broadcast, 
clustering, 
security, 
…) 
1 
2 
3 
4
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
protocol 
• RFC 
6455 
(December 
2011) 
• Two-­‐way 
communicaSon, 
replacement 
for 
Long-­‐polling 
– Beaer 
resource 
uSlizaSon 
• Extensions, 
SubProtocol 
• WebSocket 
handshake 
uses 
HTTP, 
connecSon 
is 
then 
UPGRADEd 
to 
“websocket” 
protocol 
– No 
HTTP 
since 
this 
point, 
only 
WebSocket 
frame 
are 
allowed 
to 
be 
sent 
or 
received 
– ConnecSon 
can 
be 
closed 
using 
Close 
frame 
or 
just 
closing 
underlying 
TCP 
connecSon
WebSocket 
protocol 
-­‐ 
Frame 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
protocol 
Client 
Server 
Polling 
request 
Response 
(server 
-­‐> 
client 
channel) 
Long 
polling 
WebSocket 
HTTP 
requests 
(client 
-­‐> 
server 
channel) 
Client 
Server 
Handshake 
Request 
(HTTP) 
Handshake 
Response 
(HTTP) 
Messages 
(WebSocket) 
Session 
Close 
(WebSocket)
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
Java 
API 
for 
WebSocket 
• JSR 
356 
– 
Part 
of 
Java 
EE 
7 
– 1.0 
(May 
2013) 
– 1.1 
(August 
2014) 
• Annotated 
and 
programmaSc 
way 
how 
to 
deploy 
and 
access 
WebSocket 
endpoints 
• Event-­‐driven 
model 
-­‐ 
@OnOpen, 
@OnMessage, 
@OnError, 
@OnClose 
• Encoders/Decoders, 
Path/Query 
parameter 
handling, 
Handshake 
headers 
interceptors, 
CDI 
integraSon, 
…
Java 
API 
for 
WebSocket 
– 
Annotated 
Endpoint 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Java 
API 
for 
WebSocket 
– 
ProgrammaSc 
Endpoint 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
1.1 
• JSR 
356 
Maintenance 
release 
– August 
2014 
• WEBSOCKET_SPEC-­‐226: 
Session.addMessageHandler(…) 
and 
lambdas 
• Impact: 
JDK8, 
Nashorn, 
possibly 
any 
other 
JVM 
language
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
1.1 
• Javax.websocket.Session#addMessageHandler(MessageHandler) 
– MessageHandler 
contains 
two 
sub 
interfaces, 
Whole<T> 
and 
Partial<T> 
– WebSocket 
implementaSon 
must 
know 
the 
generic 
type 
of 
added 
MessageHandler 
to 
be 
able 
to 
match 
appropriate 
javax.websocket.Decoder 
• SoluSon: 
add 
methods 
which 
provide 
the 
type 
directly 
as 
a 
parameter 
– Javax.websocket.Session#addMessageHandler(Class<T>, 
MessageHandler.Whole<T>) 
– Javax.websocket.Session#addMessageHandler(Class<T>, 
MessageHandler.Partial<T>) 
WEBSOCKET_SPEC-­‐226
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
1.0 
WebSocket 
1.0 
WebSocket 
1.1
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
1.1 
WebSocket 
1.0 
WebSocket 
1.1
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket 
1.1 
• Lesson 
learned: 
There 
is 
no 
reliable 
way 
how 
to 
get 
the 
generic 
type 
(*) 
– Not 
unSl 
generics 
reificaSon 
is 
introduced 
to 
the 
JDK 
• (*) 
during 
the 
runSme.
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
• Should 
be 
part 
of 
Java 
EE 
8 
• The 
scope 
is 
not 
clear 
yet
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
• Present 
in 
the 
specificaSon 
since 
1.0 
• WebSocket 
spec 
depends 
on 
Servlet 
(3.1) 
• Issue 
with 
CDI 
scope 
– @RequestScope 
– @SessionScope 
– @ApplicaSonScope 
– @ConversaSonScope 
• HapUpgradeHandler 
(from 
Servlet 
3.1) 
has 
CDI 
scope 
“undefined” 
CDI 
integra?on
WebSocket 
implementaSon 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
CDI 
integra?on 
Client 
Servlet 
Container 
Web 
ApplicaSon 
Handshake 
Request 
HapServletRequest 
HapServletResponse 
Handshake 
Response 
HapUpgradeHandler 
modifyHandshake() 
Endpoint 
onOpen() 
Init() 
onMessage() 
onError()* 
onClose() 
send()* 
onDataAvail() 
write()* 
messages…
WebSocket 
implementaSon 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
CDI 
integra?on 
Client 
Servlet 
Container 
Web 
ApplicaSon 
Handshake 
Request 
HapServletRequest 
HapServletResponse 
Handshake 
Response 
HapUpgradeHandler 
modifyHandshake() 
Endpoint 
onOpen() 
Init() 
onMessage() 
onError()* 
onClose() 
send()* 
onDataAvail() 
write()* 
messages… 
@RequestScope
WebSocket 
implementaSon 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
CDI 
integra?on 
Client 
Servlet 
Container 
Web 
ApplicaSon 
Handshake 
Request 
HapServletRequest 
HapServletResponse 
Handshake 
Response 
HapUpgradeHandler 
modifyHandshake() 
Endpoint 
onOpen() 
Init() 
onMessage() 
onError()* 
onClose() 
send()* 
onDataAvail() 
write()* 
messages… 
undefined
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
Low 
level 
Frame 
API 
• Support 
for 
direct 
handling 
of 
WebSocket 
Frames 
– Direct 
manipulaSon 
with 
payload 
or 
other 
frame 
properSes 
– Custom 
encrypSon, 
encoding, 
compression, 
… 
• WebSocket 
Extension 
support 
– Currently 
WebSocket 
API 
contains 
only 
negoSaSon-­‐related 
bits 
• (and 
not 
very 
well 
executed 
– 
not 
able 
to 
negoSate 
extension 
parameters, 
…) 
– Extending 
current 
API 
is 
possible, 
but…
Low 
level 
Frame 
API 
– 
WebSocket 
Extensions 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
• ExisSng 
WebSocket 
Extensions 
proposals: 
– “Compression 
Extensions 
for 
WebSocket” 
-­‐ 
Submiaed 
to 
IESG 
for 
PublicaSon 
– “A 
MulSplexing 
Extension 
for 
WebSockets” 
– 
expired 
• Other 
opSon 
is 
just 
state 
that 
implementaSon 
must/can 
support 
some 
list 
of 
extensions 
• Common 
API 
for 
Extensions 
might 
be 
hard 
to 
crat, 
since 
there 
are 
no 
exact 
rules 
about 
what 
WebSocket 
Extension 
might 
specify. 
– (this 
extension 
must 
be 
run 
as 
first 
when 
receiving 
frame 
and 
last 
when 
sending, 
…)
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
Extensions/Message(*) 
processing 
• WEBSOCKET_SPEC-­‐199 
– “Add 
the 
ability 
to 
define 
filters 
and 
interceptor” 
• API 
for 
filtering 
– Handshake 
requests? 
• It 
may 
be 
worth 
to 
have 
beaer 
control 
in 
handshake 
process 
– 
currently 
only 
response 
headers 
can 
be 
modified, 
no 
possibility 
to 
deny 
the 
request/return 
HTTP 
5xx 
response 
– WebSocket 
Frames? 
– Decoded/extracted 
messages 
(Frame 
payload)?
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
SubProtocol 
support 
• ExisSng 
WebSocket 
SubProtocol 
proposals 
– The 
WebSocket 
Protocol 
as 
a 
Transport 
for 
the 
Session 
IniSaSon 
Protocol 
(SIP) 
– 
published 
– 
RFC 
7118 
– An 
XMPP 
Sub-­‐protocol 
for 
WebSocket 
– 
almost 
done 
– 
Submiaed 
for 
publicaSon 
– The 
WebSocket 
Protocol 
as 
a 
Transport 
for 
the 
Message 
Session 
Relay 
Protocol 
(MSRP) 
– Use 
of 
the 
WebSocket 
Protocol 
as 
a 
Transport 
for 
the 
Remote 
Framebuffer 
Protocol 
– CoAP 
over 
WebSockets
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
SubProtocol 
support 
• WebSocket 
API 
supports 
SubProtocols 
only 
for 
negoSaSon 
– Which 
might 
be 
OK 
• It 
is 
not 
clear 
what 
everything 
might 
be 
needed 
for 
implemenSng 
other 
protocol 
(again, 
depends 
on 
the 
subprotocol 
specificaSon) 
• There 
seem 
to 
be 
common 
paaern 
– Using 
WebSocket 
as 
a 
Socket 
(or 
just 
stream) 
to 
send/receive 
messages/frames 
of 
the 
tunneled 
protocol 
– We 
could 
modify 
exisSng 
cases 
to 
suite 
those 
needs 
(Streamed 
MessageHandlers, 
RemoteEndpoint#getSendStream())
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
Java 
EE 
integra?on 
• JAX-­‐P, 
JAX-­‐B, 
JSON-­‐P, 
JSON-­‐B, 
… 
– Problem 
with 
missing 
metadata 
• Bean 
validaSon 
• Servlet 
4.0 
(HTTP/2) 
• CDI 
– 
injectable 
managed 
Client/Session/RemoteEndpoint 
• CDI 
– 
support 
external 
events 
(like 
CDI 
event 
which 
invokes 
broadcast)
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
Client 
API 
improvements 
• Asynchronous 
connectToServer 
method 
• Security 
– 
HTTP 
Basic/Digest/custom 
authenScaSon 
schemes 
• Security 
– 
SSL 
related 
sexngs, 
ideally 
per 
client 
connecSon 
– Might 
be 
problemaSc 
to 
agree 
on 
single 
API, 
could 
be 
solved 
on 
different 
level 
and 
shared 
among 
all 
Java 
EE 
specificaSon 
which 
do 
provide 
client 
API 
• HTTP 
Proxy 
support 
– (at 
least 
state 
that 
sexng 
Proxy 
in 
java-­‐way 
should 
be 
picked 
up)
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
WebSocket.NEXT 
Smaller 
issues 
(in 
terms 
of 
API 
changes) 
• Broadcast 
support 
– Introduce 
something 
beaer 
than 
iteraSng 
over 
Set<Session> 
• Security 
– @RolesAllowed, 
… 
-­‐ 
fine 
grain 
control 
for 
on 
endpoint 
level 
• Clustering 
– Current 
API 
is 
not 
very 
friendly 
to 
clustered 
environment 
– ProblemaSc 
parts: 
Session#getContainer(), 
Session#(add|get|del)MessageHandler, 
Session#getUserProperSes, 
… 
– Enhancements 
like 
intercepSng 
messages 
sent 
from 
other 
nodes, 
…
WebSocket.NEXT 
– 
QuesSons? 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
• WebSocket 
API 
1.1.NEXT 
• WebSocket-­‐spec: 
haps://java.net/projects/websocket-­‐spec 
– haps://java.net/jira/browse/WEBSOCKET_SPEC 
• Reference 
ImplementaSon: 
Tyrus 
haps://tyrus.java.net 
– users@tyrus.java.net 
– haps://java.net/jira/browse/TYRUS 
• Pavel 
Bucek: 
pavel.bucek@oracle.com
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
|

Mais conteúdo relacionado

Mais procurados

Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Reza Rahman
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reza Rahman
 
Introduction to ActiveMQ Apollo
Introduction to ActiveMQ ApolloIntroduction to ActiveMQ Apollo
Introduction to ActiveMQ Apollodejanb
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Bruno Borges
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012Arun Gupta
 
JavaFX and JEE 7
JavaFX and JEE 7JavaFX and JEE 7
JavaFX and JEE 7Vijay Nair
 
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012Arun Gupta
 
GlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGGlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGArun Gupta
 
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
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6Bert Ertman
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
Introducing WebLogic 12c OTN Tour 2012
Introducing WebLogic 12c OTN Tour 2012Introducing WebLogic 12c OTN Tour 2012
Introducing WebLogic 12c OTN Tour 2012Bruno Borges
 
Great Java Application Server Debate
Great Java Application Server DebateGreat Java Application Server Debate
Great Java Application Server DebateHamed Hatami
 
Burns jsf-confess-2015
Burns jsf-confess-2015Burns jsf-confess-2015
Burns jsf-confess-2015Edward Burns
 
Java EE7 Demystified
Java EE7 DemystifiedJava EE7 Demystified
Java EE7 DemystifiedAnkara JUG
 

Mais procurados (19)

Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
 
Servlet 3.1
Servlet 3.1Servlet 3.1
Servlet 3.1
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
 
JavaFX Uni Parthenope
JavaFX Uni ParthenopeJavaFX Uni Parthenope
JavaFX Uni Parthenope
 
Introduction to ActiveMQ Apollo
Introduction to ActiveMQ ApolloIntroduction to ActiveMQ Apollo
Introduction to ActiveMQ Apollo
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
JavaFX and JEE 7
JavaFX and JEE 7JavaFX and JEE 7
JavaFX and JEE 7
 
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
 
GlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGGlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUG
 
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.
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
Introducing WebLogic 12c OTN Tour 2012
Introducing WebLogic 12c OTN Tour 2012Introducing WebLogic 12c OTN Tour 2012
Introducing WebLogic 12c OTN Tour 2012
 
Great Java Application Server Debate
Great Java Application Server DebateGreat Java Application Server Debate
Great Java Application Server Debate
 
Burns jsf-confess-2015
Burns jsf-confess-2015Burns jsf-confess-2015
Burns jsf-confess-2015
 
Java EE7 Demystified
Java EE7 DemystifiedJava EE7 Demystified
Java EE7 Demystified
 

Semelhante a What's next for Java API for WebSocket (JSR 356)

WebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoWebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoBruno Borges
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouDavid Delabassee
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015Pavel Bucek
 
WebRTC with Java
WebRTC with JavaWebRTC with Java
WebRTC with Javaamithap07
 
JavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth SlidesJavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth SlidesEdward Burns
 
What's New and Noteworthy on Oracle CAF 12.1.3
What's New and Noteworthy on Oracle CAF 12.1.3What's New and Noteworthy on Oracle CAF 12.1.3
What's New and Noteworthy on Oracle CAF 12.1.3Bruno Borges
 
CON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EE
CON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EECON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EE
CON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EEMasoud Kalali
 
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckServlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckEdward Burns
 
WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)Oracle
 
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
 
2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portionmnriem
 
Java EE7 in action
Java EE7 in actionJava EE7 in action
Java EE7 in actionAnkara JUG
 
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)David Delabassee
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! David Delabassee
 
Servlet 4.0 JavaOne 2017
Servlet 4.0 JavaOne 2017Servlet 4.0 JavaOne 2017
Servlet 4.0 JavaOne 2017Ed Burns
 
HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016Ed Burns
 
Real-World RESTful Service Development Problems and Solutions
Real-World RESTful Service Development Problems and SolutionsReal-World RESTful Service Development Problems and Solutions
Real-World RESTful Service Development Problems and SolutionsMasoud Kalali
 
JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKWolfgang Weigend
 
Java Community and Overview Track - March 2016
Java Community and Overview Track - March 2016Java Community and Overview Track - March 2016
Java Community and Overview Track - March 2016Yolande Poirier
 

Semelhante a What's next for Java API for WebSocket (JSR 356) (20)

WebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo ConectadoWebSockets - Realtime em Mundo Conectado
WebSockets - Realtime em Mundo Conectado
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015
 
WebRTC with Java
WebRTC with JavaWebRTC with Java
WebRTC with Java
 
JavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth SlidesJavaOne 2014 Java EE 8 Booth Slides
JavaOne 2014 Java EE 8 Booth Slides
 
What's New and Noteworthy on Oracle CAF 12.1.3
What's New and Noteworthy on Oracle CAF 12.1.3What's New and Noteworthy on Oracle CAF 12.1.3
What's New and Noteworthy on Oracle CAF 12.1.3
 
CON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EE
CON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EECON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EE
CON 2107- Think Async: Embrace and Get Addicted to the Asynchronicity of EE
 
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckServlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
 
WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)
 
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...
 
2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion
 
Java EE7 in action
Java EE7 in actionJava EE7 in action
Java EE7 in action
 
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
 
Servlet 4.0 JavaOne 2017
Servlet 4.0 JavaOne 2017Servlet 4.0 JavaOne 2017
Servlet 4.0 JavaOne 2017
 
HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016
 
Real-World RESTful Service Development Problems and Solutions
Real-World RESTful Service Development Problems and SolutionsReal-World RESTful Service Development Problems and Solutions
Real-World RESTful Service Development Problems and Solutions
 
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško VukmanovićJavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
 
JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDK
 
Java Community and Overview Track - March 2016
Java Community and Overview Track - March 2016Java Community and Overview Track - March 2016
Java Community and Overview Track - March 2016
 

Último

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 

Último (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
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!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 

What's next for Java API for WebSocket (JSR 356)

  • 1.
  • 2.
  • 3. WebSocket API.NEXT Pavel Bucek (pavel.bucek@oracle.com) Oracle September 29, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 4. Safe Harbor Statement The following is intended to outline our general product direcSon. It is intended for informaSon purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or funcSonality, and should not be relied upon in making purchasing decisions. The development, release, and Sming of any features or funcSonality described for Oracle’s products remains at the sole discreSon of Oracle. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda Short intro about JSR 356 – Java API for WebSocket WebSocket API 1.1 WebSocket.NEXT CDI, Frame API, Extensions, SubProtocols, Java EE integraSon, Client API enhancements, smaller issues (broadcast, clustering, security, …) 1 2 3 4
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket protocol • RFC 6455 (December 2011) • Two-­‐way communicaSon, replacement for Long-­‐polling – Beaer resource uSlizaSon • Extensions, SubProtocol • WebSocket handshake uses HTTP, connecSon is then UPGRADEd to “websocket” protocol – No HTTP since this point, only WebSocket frame are allowed to be sent or received – ConnecSon can be closed using Close frame or just closing underlying TCP connecSon
  • 7. WebSocket protocol -­‐ Frame Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket protocol Client Server Polling request Response (server -­‐> client channel) Long polling WebSocket HTTP requests (client -­‐> server channel) Client Server Handshake Request (HTTP) Handshake Response (HTTP) Messages (WebSocket) Session Close (WebSocket)
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Java API for WebSocket • JSR 356 – Part of Java EE 7 – 1.0 (May 2013) – 1.1 (August 2014) • Annotated and programmaSc way how to deploy and access WebSocket endpoints • Event-­‐driven model -­‐ @OnOpen, @OnMessage, @OnError, @OnClose • Encoders/Decoders, Path/Query parameter handling, Handshake headers interceptors, CDI integraSon, …
  • 10. Java API for WebSocket – Annotated Endpoint Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 11. Java API for WebSocket – ProgrammaSc Endpoint Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket 1.1 • JSR 356 Maintenance release – August 2014 • WEBSOCKET_SPEC-­‐226: Session.addMessageHandler(…) and lambdas • Impact: JDK8, Nashorn, possibly any other JVM language
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket 1.1 • Javax.websocket.Session#addMessageHandler(MessageHandler) – MessageHandler contains two sub interfaces, Whole<T> and Partial<T> – WebSocket implementaSon must know the generic type of added MessageHandler to be able to match appropriate javax.websocket.Decoder • SoluSon: add methods which provide the type directly as a parameter – Javax.websocket.Session#addMessageHandler(Class<T>, MessageHandler.Whole<T>) – Javax.websocket.Session#addMessageHandler(Class<T>, MessageHandler.Partial<T>) WEBSOCKET_SPEC-­‐226
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket 1.0 WebSocket 1.0 WebSocket 1.1
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket 1.1 WebSocket 1.0 WebSocket 1.1
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket 1.1 • Lesson learned: There is no reliable way how to get the generic type (*) – Not unSl generics reificaSon is introduced to the JDK • (*) during the runSme.
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT • Should be part of Java EE 8 • The scope is not clear yet
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT • Present in the specificaSon since 1.0 • WebSocket spec depends on Servlet (3.1) • Issue with CDI scope – @RequestScope – @SessionScope – @ApplicaSonScope – @ConversaSonScope • HapUpgradeHandler (from Servlet 3.1) has CDI scope “undefined” CDI integra?on
  • 19. WebSocket implementaSon Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT CDI integra?on Client Servlet Container Web ApplicaSon Handshake Request HapServletRequest HapServletResponse Handshake Response HapUpgradeHandler modifyHandshake() Endpoint onOpen() Init() onMessage() onError()* onClose() send()* onDataAvail() write()* messages…
  • 20. WebSocket implementaSon Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT CDI integra?on Client Servlet Container Web ApplicaSon Handshake Request HapServletRequest HapServletResponse Handshake Response HapUpgradeHandler modifyHandshake() Endpoint onOpen() Init() onMessage() onError()* onClose() send()* onDataAvail() write()* messages… @RequestScope
  • 21. WebSocket implementaSon Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT CDI integra?on Client Servlet Container Web ApplicaSon Handshake Request HapServletRequest HapServletResponse Handshake Response HapUpgradeHandler modifyHandshake() Endpoint onOpen() Init() onMessage() onError()* onClose() send()* onDataAvail() write()* messages… undefined
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT Low level Frame API • Support for direct handling of WebSocket Frames – Direct manipulaSon with payload or other frame properSes – Custom encrypSon, encoding, compression, … • WebSocket Extension support – Currently WebSocket API contains only negoSaSon-­‐related bits • (and not very well executed – not able to negoSate extension parameters, …) – Extending current API is possible, but…
  • 23. Low level Frame API – WebSocket Extensions Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT • ExisSng WebSocket Extensions proposals: – “Compression Extensions for WebSocket” -­‐ Submiaed to IESG for PublicaSon – “A MulSplexing Extension for WebSockets” – expired • Other opSon is just state that implementaSon must/can support some list of extensions • Common API for Extensions might be hard to crat, since there are no exact rules about what WebSocket Extension might specify. – (this extension must be run as first when receiving frame and last when sending, …)
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT Extensions/Message(*) processing • WEBSOCKET_SPEC-­‐199 – “Add the ability to define filters and interceptor” • API for filtering – Handshake requests? • It may be worth to have beaer control in handshake process – currently only response headers can be modified, no possibility to deny the request/return HTTP 5xx response – WebSocket Frames? – Decoded/extracted messages (Frame payload)?
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT SubProtocol support • ExisSng WebSocket SubProtocol proposals – The WebSocket Protocol as a Transport for the Session IniSaSon Protocol (SIP) – published – RFC 7118 – An XMPP Sub-­‐protocol for WebSocket – almost done – Submiaed for publicaSon – The WebSocket Protocol as a Transport for the Message Session Relay Protocol (MSRP) – Use of the WebSocket Protocol as a Transport for the Remote Framebuffer Protocol – CoAP over WebSockets
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT SubProtocol support • WebSocket API supports SubProtocols only for negoSaSon – Which might be OK • It is not clear what everything might be needed for implemenSng other protocol (again, depends on the subprotocol specificaSon) • There seem to be common paaern – Using WebSocket as a Socket (or just stream) to send/receive messages/frames of the tunneled protocol – We could modify exisSng cases to suite those needs (Streamed MessageHandlers, RemoteEndpoint#getSendStream())
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT Java EE integra?on • JAX-­‐P, JAX-­‐B, JSON-­‐P, JSON-­‐B, … – Problem with missing metadata • Bean validaSon • Servlet 4.0 (HTTP/2) • CDI – injectable managed Client/Session/RemoteEndpoint • CDI – support external events (like CDI event which invokes broadcast)
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT Client API improvements • Asynchronous connectToServer method • Security – HTTP Basic/Digest/custom authenScaSon schemes • Security – SSL related sexngs, ideally per client connecSon – Might be problemaSc to agree on single API, could be solved on different level and shared among all Java EE specificaSon which do provide client API • HTTP Proxy support – (at least state that sexng Proxy in java-­‐way should be picked up)
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebSocket.NEXT Smaller issues (in terms of API changes) • Broadcast support – Introduce something beaer than iteraSng over Set<Session> • Security – @RolesAllowed, … -­‐ fine grain control for on endpoint level • Clustering – Current API is not very friendly to clustered environment – ProblemaSc parts: Session#getContainer(), Session#(add|get|del)MessageHandler, Session#getUserProperSes, … – Enhancements like intercepSng messages sent from other nodes, …
  • 30. WebSocket.NEXT – QuesSons? Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | • WebSocket API 1.1.NEXT • WebSocket-­‐spec: haps://java.net/projects/websocket-­‐spec – haps://java.net/jira/browse/WEBSOCKET_SPEC • Reference ImplementaSon: Tyrus haps://tyrus.java.net – users@tyrus.java.net – haps://java.net/jira/browse/TYRUS • Pavel Bucek: pavel.bucek@oracle.com
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |