Skip to Content
Java EE 8 Application Development
book

Java EE 8 Application Development

by David R. Heffelfinger
December 2017
Intermediate to advanced
372 pages
8h 46m
English
Packt Publishing
Content preview from Java EE 8 Application Development

JavaScript Server-sent events client

So far, all of our client examples have either used the curl command-line utility or the JAX-RS RESTful web server client API. It is very common to use JavaScript code running on a browser as a RESTful web service client, therefore, in this section, we will take that approach. The following example illustrates an HTML/JavaScript client receiving server-sent events:

<!DOCTYPE html> <html> <head> <title>Stock Ticker Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body onload="getStockTickerValues()"> <h2>Super fancy stock ticker monitor</h2> <table cellspacing="0" cellpadding="0"> <tr> <td>ENSD Stock Ticker Value: </td> <td> <span id="stickerVal"></span></td> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java EE 8 Development with Eclipse

Java EE 8 Development with Eclipse

Ram Kulkarni
Beginning EJB in Java EE 8: Building Applications with Enterprise JavaBeans

Beginning EJB in Java EE 8: Building Applications with Enterprise JavaBeans

Jonathan Wetherbee, Massimo Nardone, Chirag Rathod, Raghu Kodali

Publisher Resources

ISBN: 9781788293679Supplemental Content