adding support for length prefixed json on the client socket