HTML and CSS Reference
In-Depth Information
Frameworks
There are just about as many Comet, AJAX push-based, WebSocket frameworks and
servers as there are mobile web frameworks. So sorting out which ones are built for
lightweight mobile environments and which ones may be suitable only for desktop
browsers is essential. Keep in mind that graceful degradation comes at a cost. If you
choose a WebSocket framework that degrades in 10 different ways, you do not want
your mobile clients to be penalized with a heavy framework download. To provide real-
time connectivity to every browser, you need a framework that will detect the most
capable transport at runtime.
You may already be familiar with projects such as Node.js , Ruby EventMachine, or
Python Twisted. These projects use an event-based API to allow you to create network-
aware applications in just a few lines of code. But what about enterprise-grade perfor‐
mance and concurrency? Take a look at how a few of your options stack up.
Vert.x
A fully asynchronous, general-purpose application container for JVM languages,
Vert.x ) takes inspiration from such event-driven frameworks as Node.js , then combines
it with a distributed event bus and sticks it all on the JVM. The result is a runtime with
real concurrency and unrivalled performance. Vert.x then exposes the API in Ruby,
JavaScript, Groovy, and Java. Vert.x supports TCP, HTTP, WebSockets, and many more
modules. You can think of it as Node.js for JVM languages.
Vert.x recommends SockJS to provide a WebSocket-like object on the client. Under the
hood, SockJS tries to use native WebSockets first. If that fails, it can use a variety of
browser-specific transport protocols and presents them through WebSocket-like ab‐
stractions. SockJS is intended to work for all modern browsers and in environments that
don't support WebSocket protcol, such as behind restrictive corporate proxies.
Vert.x requires JDK 1.7.0. It uses such open source projects as Netty, JRuby, Mozilla
Rhino, and Hazelcast, and is under MIT and Apache 2.0 license.
The code for SockJS page set-up is:
<!DOCTYPE html>
<html>
<head>
<title> my app </title>
</head>
<body>
<script src= "http://cdn.sockjs.org/sockjs-0.1.min.js" ></script>
</body>
</html>
To use SockJS:
Search WWH ::




Custom Search