Also, create on_close callback on json_connection, so clients can know when the connection has failed.