Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 1.02 KB

File metadata and controls

24 lines (17 loc) · 1.02 KB

RustPlusApi.Extensions.DependencyInjection

Microsoft.Extensions.DependencyInjection registration extensions for RustPlusApi.

// one configured client (singleton, container-disposed)
services.AddRustPlus(new DirectConnection("12.34.56.78", 28082, playerId, playerToken));

// or bound from configuration: Server, Port, PlayerId, PlayerToken binds a DirectConnection;
// ServerId, AuthToken, PlayerId, PlayerToken binds a CompanionConnection
services.AddRustPlus(configuration.GetSection("Rust"));

// many / runtime connections: caller-owned clients via the factory
services.AddRustPlusFactory();
await using var client = provider.GetRequiredService<IRustPlusFactory>().Create(connection);

Logging auto-wires from the host's ILoggerFactory; tuning via IOptions<RustPlusSocketOptions>. Nothing auto-connects — call ConnectAsync when ready.

Documentation