Unit 6 Reading Guide

First, read selected portions of the Oracle Tutorial:

Note that you'll probably have to read all of this before you start to get a sense of how WebSockets works. You might even want to read it twice.

Also look at the code in "part 1" of the "simple example." This is a complete, if simple, server.

Finally, look at the example with a "Java client." You can skip the introductory material; start with "The Application." Don't worry too much about the chunk of server code on lines 11-34, or the client code on lines 16-49. (Though you should certainly read that code and try to get a sense of what it's doing.)

We talked briefly about annotations; if you need a refresher or more information, the wikipedia page is a good place to start. This Oracle tutorial may also be helpful.

That will prepare you for the RAT (and see the questions below)

We will, later, need section 18.7 from the tutorial and "part 2" of the simple example.

Finally, note that we'll need some extra stuff to get WebSockets code running in Eclipse. So don't frustrate yourself trying to get the code in the readings to run.

Questions to Guide Your Reading

  1. Web interactions are usually "request-response;" how is WebSockets different?
  2. How is a WebSocket "endpoint" different from a web server? How are they related?
  3. What are the 4 elements of an endpoint's lifecycle? What "events" do they correspond to?
  4. We know that with regular sockets, the server waits to accept() client connections. In WebSockets, what method of the server "endpoint" runs when a client tries to connect?
  5. What kind of object keeps track of information about the current "conversation"?
  6. How is the Properties class related to WebSockets?
  7. How does the WebSockets API make sure that received text messages are handled differently from received binary messages?