HTML and CSS Reference
In-Depth Information
Figure 4.1. The simple chat application in action
As you can see, the user types a message into the text input and hits Enter or the Chat but-
ton, and his words of wisdom are immediately distributed to everyone else online. The chat
shown in figure 4.1 is, of course, entirely manufactured. Rest assured; the authors are not
that corny in real life.
As you might guess from the name, server- sent events, the server sends events to the
browser; it can't receive information via SSE. Communication from the browser back to
the server, new chat messages entered by the user, will use traditional AJAX methods. Fig-
ure 4.2 illustrates the flow of chat messages in the application.
 
Search WWH ::




Custom Search