7. Do you have any news for me?
No
Do you have any news for me?
No
Do you have any news for me?
No!!!!@#$%
8. AJAX POLLING
• The requested webpage executes JS which requests
to server at regular intervals (e.g. 0.5 seconds).
• The server calculates each response and sends it
back, just like normal http traffic.
9. Do you have any news for me?
…
…
Here you are!
“#%#$%@@!”
Anything else?
…
10. AJAX LONG-POLLING
• The requested webpage executes JS which requests
a file from the server.
• The server does not immediately respond with the
requested information but waits until there's new
information available.
• The client receives the new information and
immediately sends another request to the server, re-
starting the process.
12. HTML5 WEBSOCKETS
• The requested webpage executes JS which opens a
connection with the server.
• The server and the client can now send each other
messages when new data is available.
14. … Ajax Polling
Ajax Long-
polling
WebSocket
Browser support
Supported by the
most of currently
used browsers
Supported by the
most of currently
used browsers
IE 10+,…
(caniuse.com)
Server-loading
It repeatedly
calculates and
responses a lot of
requests from
clients.
Takes little of
CPU resources,
but creates idle
processes.
The best possible
solution. No
loops, only take
CPU/memory
per client action.
Client-loading
Natively
implemented in
the browser
Natively
implemented in
the browser
Natively
implemented in
the browser
Timeliness
Can adjust the
interval settings.
Near real-time True real-time
15.
16. JETTY EMBEDDED
• Jetty provides a Web server and javax.servlet
container plus support for WebSocket.
• Standalone
31. ONE MORE THING
• Your application feel
like a Superman, if all
your data is located on
the memory (Local
Caching is the best
solution).
• And don’t read HDD
too much.