In this chapter, we will write a Web application that sends and receives messages using the STOMP protocol over HTML5 Web Sockets.
Locations Application Using STOMP, we described the
Locations application. In this chapter, we will write the Web application that consumes the device’s GPS position to display them on a map and sends text messages to the devices.
All along the chapter, we will show all the code required to run the application.
The whole application code can be retrieved from the GitHub repository in the
Web Sockets is a recent features of Web browser that provides a bi-directional and full-duplex communication channel over a single TCP connection between the Web browser and the Web server. Before Web Sockets, communication was only one-way: the browser initiates the communication by sending a HTTP request to the Web server which replies with a HTTP response. The server could not send data to the browser without the browser having first sent a request. There exists some techniques to provide a bi-directional HTTP (such as HTTP long polling and HTTP streaming) but they have significant issues as described in (to come).
Thanks to HTML5 Web Sockets, it is now possible to have two-way communication between the browser and the server. The ...