The VeeFriends Restream Chat Library provides a seamless integration with both Twilio and Restream, allowing developers to manage and relay chat messages across multiple platforms. It includes classes for handling chat events, messages, and user interactions, along with configuration options for customization. With a focus on performance and scalability, this library is designed to meet the needs of real-time chat applications.
$ dotnet add package VeeFriends.Restream.ChatThis package provides integration with Twilio and Restream for relaying chat messages.
$ dotnet add package VeeFriends.Restream.Chat
This library enables the handling and relaying of chat messages across different platforms, including Restream and Twilio.
Configure the relay options with the necessary credentials for Twilio and Restream.
var relayOptions = new RelayOptions
{
TwilioChatAccountSid = "your-account-sid",
TwilioChatAuthToken = "your-auth-token",
TwilioChatServiceId = "your-service-id",
RestreamChatEmbedId = "your-embed-id"
};
You can easily add the Relay class to your ASP.NET Core project using the provided extension method:
public void ConfigureServices(IServiceCollection services)
{
var relayOptions = new RelayOptions
{
// Set relay options here
// ...
};
services.AddRestreamToTwiloRelay(relayOptions);
// Other services
}
This extension method abstracts the process of registering the Relay class with the DI container, providing a convenient way to include the functionality in an ASP.NET Core application.
Create an instance of the Relay class using the configured options.
var relay = new Relay(relayOptions);
Start listening to a specific conversation using one of the available methods:
var stopOn = DateTime.Now.AddMinutes(10);
relay.StartListening("conversation-id", stopOn, cancellationToken);
var stopIn = TimeSpan.FromMinutes(10);
relay.StartListening("conversation-id", stopIn, cancellationToken);
relay.StartListening("conversation-id", async () =>
{
// Your custom logic here
return await Task.FromResult(false);
}, cancellationToken);
You can extend the functionality by implementing your logic for handling messages within the relay classes and methods.
Feel free to explore the code and tailor it to your specific needs.