improved web socket message parsing