Moved some looping logic from websocket to client.c

Also made the buffer for the frame in the websocket sending part
big enough based on the length we receive in the calling.

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