The
Java EE 7 specification adds new functionality to the Java EE specification. One
capability many developers were asking for is support for WebSockets. Real-time
bidirectional traffic on the internet is growing. Different actors are involved
in this area, including content providers, broadcasters, software developers,
and telecom operators. Due to the different characteristics of the involved
actors, the success of WebSockets required
standardization. The Internet Engineering Task Force (IETF) defined a standard
for the WebSocket protocol. This standard defines
the low-level protocol that technologies implementing WebSockets should adhere
to. For example, it defines how an HTTP connection should
be upgraded to a full-duplex bidirectional WebSocket connection. The importance
of this standard cannot be underestimated. Different languages and platforms are
used to develop applications relying on WebSockets,
and they should all rely on the same protocol in order to be interoperable. On
top of the WebSocket protocol, a number of technologies and
implementations exist facilitating the use of WebSockets in a specific language
or platform. For example, the W3C has a working draft describing how
to leverage WebSockets from a web page, and ever since Java EE 7, a similar specification
has existed for dealing with WebSockets in Java. This specification is defined
in JSR 356 and was approved to be part of the Java
EE 7 specification. The Java API for WebSocket contains a server API and a client
API. Containers that claim to be Java EE 7– compliant implement the server API.
The only real difference between a server container
and a client container is that a server container provides the infrastructure for
registering WebSocket endpoints—it will listen for incoming requests on
specific endpoints. The client API is, therefore, a subset of the server API. The
Reference Implementation for JSR 356, named Tyrus, is included in GlassFish 4
and contains client modules as well as server modules. The client modules can
be used in any Java
application and allow developers to connect to any WebSocket endpoint, as long as
the endpoint adheres to the IETF 6455 standard. On top
of the client modules, the server modules allow applications to register
endpoints that will handle all WebSocket communications, as long as the other peer
(the client) adheres to the IETF 6455 standard.
No comments:
Post a Comment