Files
rudder-csharp-sdk/Abstractions/IRealtimeTransport.cs
T

37 lines
1.3 KiB
C#
Raw Permalink Normal View History

2026-08-12 14:04:55 +03:00
using System;
using System.Threading;
using System.Threading.Tasks;
namespace RudderSdk.Core.Abstractions;
/// <summary>
/// Low-level realtime (websocket) transport. There is no default implementation;
/// provide one through <see cref="IRealtimeTransportFactory"/> (Unity ships its own).
/// </summary>
public interface IRealtimeTransport
{
/// <summary>Raised when the connection closes.</summary>
event Action Closed;
/// <summary>Raised for every incoming message.</summary>
event Action<ArraySegment<byte>> Received;
/// <summary>Raised on transport errors.</summary>
event Action<Exception> Error;
/// <summary>True while the connection is open.</summary>
bool IsConnected { get; }
/// <summary>Opens the connection, giving up after <paramref name="timeout"/>.</summary>
Task ConnectAsync(Uri uri, TimeSpan timeout, CancellationToken cancellationToken = default);
/// <summary>Sends one message.</summary>
Task SendAsync(ArraySegment<byte> data, CancellationToken cancellationToken = default);
/// <summary>Closes the connection.</summary>
Task CloseAsync(CancellationToken cancellationToken = default);
/// <summary>Pumps time-dependent logic; call every frame.</summary>
void Update(float deltaTime);
}