You can now start using the socket for sending and receiving data. But what's
with the p in WebSockets p ()?

Well, the answer is that this library aims to support many versions of the
WebSockets protocol. Unfortunately, not all versions of the protocol have the
same capabilities: for example, older versions are not able to send binary
data.

The library user (you!) choose which capabilities you need. Then, the browser
and library will negotiate at runtime which version will be actually used.

As an example, here are two applications which need different capabilities:

When you tie the knot, you will need to decide what protocol to use, to
prevent ambiguousness. A good rule of thumb is to select the lowest protocol
possible, since higher versions are generally backwards compatible in terms
of features. . For example, the following application uses only
features from Hybi00, and is therefore compatible with Hybi10 and later
protocols.

In some cases, you want to escape from the WebSockets monad and send data
to the websocket from different threads. To this end, the getSink method
is provided. The next example spawns a thread which continuously spams the
client in another thread:

Run a WebSockets application on an 'Enumerator'/'Iteratee' pair, given
that you (read: your web server) has already received the HTTP part of the
initial request. If not, you might want to use runWebSocketsWithHandshake
instead.

If the handshake failed, throws a HandshakeError. Otherwise, executes the
supplied continuation. You should still send a response to the client
yourself.