Initial web socket API.

This PR is to a `websocket` feature branch for later merging into `master`.
In Callback we call this `onFailure`. We should rename one or the other.