async fn rpc_write<T>(conn: &mut TcpStream, msg: T) -> Result<(), ExternalError>where T: Serialize,
Write an RPC message to the given connection.