Cleanup websocket handler, Fix encoding issue with json_batched