Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user