Changed the websocket implementation.

This implementation is lifted from cowboy and handles framing.

Fixes #826