Moved the websocket handshaking to websocket.c as well

Also freeing the key after the handshake is complete to save
some extra memory.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>