Orizon Rpc

Library

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

orizon updated 1y ago 0 MB engine 17
thumb_up 2 open_in_new View on sbox.game
Orizon 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;
}
No usage statistics available
This package may be new or not widely used yet. Usage data becomes available as more users install and play with the package.
0 recorded entries
Rank Player Score Recorded
refresh
Discovering package leaderboards...
Package ID: orizon.orizon_rpc
Created: 2025-02-05 13:30 UTC
Updated: 2025-02-15 20:48 UTC
Type: library
Public: Yes
Version: 88162
files: 15
Size: 0.0 MB
Engine Version: 17
Asset Version ID: 88162
Version Created: 2025-02-15 20:48 UTC
Hash: 6662336366500011506
Manifest: Open manifest

more_horiz Additional Properties

Compiler: {"RootNamespace":"Orizon","DefineConstants":"SANDBOX;ADDON;DEBUG","NoWarn":"1701;1702;1591;","WarningsAsErrors":"","TreatWarningsAsErrors":false,"Nullables":true,"Whitelist":true,"ReleaseMode":"Debug","AssemblyReferences":[],"IgnoreFolders":[],"DistinctAssemblyReferences":[]}
new_releases Latest Update Feb 15, 2025
Changes on 2025-02-15
88162 Feb 15, 2025
Changes on 2025-02-15
88159 Feb 15, 2025
Changes on 2025-02-15
86750 Feb 8, 2025
Changes on 2025-02-08
86411 Feb 5, 2025
Changes on 2025-02-05
info Live API Passthrough & Removal Notice

This file manifest and asset metadata are retrieved live directly from the official Facepunch s&box public API. s&box Explorer does not host, store, or redistribute any package files. All download links route directly to Facepunch CDN servers.