Move websocket handling code to websockets package.

Review the documentation.