Skip to content

Unofficial C# client library for the Streamlabs socket API. Allows you to receive events from Streamlabs in real-time.

License

Notifications You must be signed in to change notification settings

meenzen/Streamlabs.SocketClient

Repository files navigation

GitHub codecov NuGet NuGet FOSSA Status

Streamlabs.SocketClient

Unofficial C# client library for the Streamlabs socket API. Allows you to receive events from Streamlabs in real-time.

Installation

dotnet add package Streamlabs.SocketClient

If you use Dependency Injection, you can use the Streamlabs.SocketClient.Extensions package for easier setup.

dotnet add package Streamlabs.SocketClient.Extensions
// provide the token directly
builder.Services.AddStreamlabsClient(options => options.Token = "store your token somewhere safe");

// or use a configuration section
builder.Services.AddStreamlabsClient(configuration.GetSection("Streamlabs"));

// automatically connect and disconnect the client
builder.Services.AddHostedService<StreamlabsStartStopWorker>();

// get the client via DI and use it
var client = serviceProvider.GetRequiredService<IStreamlabsClient>();
client.OnDonation += (sender, message) => Console.WriteLine($"Donation Received: {message.FormattedAmount}");

Usage

First, you'll need to grab your Socket API Token from the Streamlabs Dashboard.

Open the Dashboard, then navigate to Avatar MenuAccount SettingsAPI SettingsAPI Tokens. You will find the token in the field Your Socket API Token.

Now you're ready to set up the client. These examples show how to set up the client and listen for events:

Contributing

Pull requests are welcome. Please use Conventional Commits to keep commit messages consistent.

When reporting bugs, please include the raw JSON payload of the event that caused the issue. You can find it attached to the error message or by enabling debug logging and looking for Streamlabs: Event received - [json]. Alternatively, you can use the Event Capture tool to capture events and save them to a file.

Acknowledgements

License

Distributed under the MIT License. See LICENSE for more information.

FOSSA Status

About

Unofficial C# client library for the Streamlabs socket API. Allows you to receive events from Streamlabs in real-time.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •