websocket parser and encoder