Initial web socket API.

This PR is to a `websocket` feature branch for later merging into `master`.
This is a blocking API. I should probably mention that somewhere in a class-level javadoc.