---
title: "Orizon Rpc - s&box library"
description: "A simple library to call rpc's and receive a response callback"
canonical: "https://sbox.watch/zh-cn/libraries/orizon/orizon_rpc/"
generated_at: "2026-11-27T20:06:25.562Z"
---

# Orizon Rpc

A simple library to call rpc's and receive a response callback

- 类型: 库
- 标识符: orizon.orizon_rpc
- 创作者: orizon
- 规范地址: https://sbox.watch/zh-cn/libraries/orizon/orizon_rpc/
- Markdown: https://sbox.watch/zh-cn/libraries/orizon/orizon_rpc/index.md
- sbox.game: https://sbox.game/orizon/orizon_rpc/
- 生成时间: 2026-11-27T20:06:25.562Z

## 统计

- 24小时热度: +0
- Terry 评分: 43%
- 收藏: 2
- 好评: 2
- 差评: 0
- 更新时间: 2025年2月15日
- 创建时间: 2025年2月5日
- 大小: 17.7 KB
- 文件: 15
- 标签: callback, networking, rpc

## 描述

// Your data model
public struct YourData
{
 public SteamId SteamId { get; set; }
 public string FirstName { get; set;}
}

// Create your struct request
private record struct GetDataRequest : IRpcRequest
{
 public Guid CallbackId { get; set; }
 public int DataId { get; set; }
}

// Create your struct response
private record struct GetDataResponse : IRpcResponse
{
 public Guid CallbackId { get; set; }
 public YourData Data { get; set; }
}

// Called on the host
private static GetDataResponse OnGetDataRequest( GetDataRequest request )
{
 // Do your work here and return the result
 var data = ...

 return new GetDataResponse { Data = data };
}
In your custom script, e.g Character.cs
// Register your rpc callback here
protected override void OnStart()
{
 if ( IsProxy ) return;

 RpcServer.RegisterHandler<GetDataRequest, GetDataResponse>( OnGetDataRequest );
}

// Call this function on the client to get your data
public static async Task<YourData> GetDataAsync( int dataId )
{
 var request = new GetDataRequest { DataId = dataId };

 // Your data is store in the result variable
 var result = await RpcClient.SendRpc<GetDataRequest, GetDataResponse>( request );
 return result.Data;
}



## More by orizon

| Package | 标识符 | 玩家 | 收藏 | 好评 | 评分 | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Mongo Rest | orizon.mongo_rest | 0 | 0 | 2 | 43% | https://sbox.watch/zh-cn/libraries/orizon/mongo_rest/index.md |
