In this chapter we looked at advanced topics for WebSockets and Server-sent Events. We demonstrated with code snippets how to use encoders and decoders and how to receive different kinds of data using WebSockets. We also demonstrated a sample that showed how WebSockets will work with SSL so that when working with proxy servers, the communication is encrypted.
We also discussed best practices for implementing Server-sent Events and WebSockets. We learned how to ensure messages are not lost in Server-sent Events by associating IDs with events. We covered the Jersey Client API for Server-sent Events.
In the next chapter, we will cover more advanced topics such as JSON API in Java EE and the aspects of asynchronous programming to improve scalability with respect to various Java EE specifications such as JAX-RS 2.0, EJB and Servlets.