Server-side scenario execution: new Rudder.Core.dll, realtime/planstore glue removed
- Rudder.Core.dll rebuilt from csharp-sdk effects rewrite (96,768 bytes) - Realtime/ adapters, UnityRealtimeTransportFactory, UnityPlanStateStore, UnityPlanScheduler, WebGL jslib and RealtimeUrl config deleted (with .meta) - Scenarios sample rewired to client.Effects; samples login path updated - AGENTS.md/README/CHANGELOG/package docs + agent skill updated; realtime.md skill doc removed
This commit is contained in:
@@ -11,16 +11,12 @@ namespace RudderSdk.Unity
|
||||
var clientOptions = new RudderClientOptions
|
||||
{
|
||||
BaseUrl = options.BaseUrl,
|
||||
RealtimeUrl = options.RealtimeUrl,
|
||||
ProjectKey = options.ProjectKey,
|
||||
Logger = new UnityLoggerAdapter(options.LoggerSink ?? new UnityDebugLoggerSink()),
|
||||
Transport = new UnityTransportAdapter(options.BaseUrl, executor),
|
||||
TokenStore = new UnityTokenStoreAdapter(options.KeyValueStore),
|
||||
DeviceIdProvider = new UnityDeviceIdProvider(),
|
||||
Clock = new UnityClock(),
|
||||
PlanStateStore = new UnityPlanStateStore(options.KeyValueStore),
|
||||
Scheduler = new UnityPlanScheduler(),
|
||||
RealtimeTransportFactory = new UnityRealtimeTransportFactory()
|
||||
Clock = new UnityClock()
|
||||
};
|
||||
|
||||
return new RudderClient(clientOptions);
|
||||
|
||||
@@ -3,7 +3,6 @@ namespace RudderSdk.Unity
|
||||
public class RudderUnityClientOptions
|
||||
{
|
||||
public string BaseUrl { get; set; }
|
||||
public string RealtimeUrl { get; set; }
|
||||
public string ProjectKey { get; set; }
|
||||
public int TimeoutSeconds { get; set; } = 10;
|
||||
public IUnityKeyValueStore KeyValueStore { get; set; }
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using RudderSdk.Core.Abstractions;
|
||||
|
||||
namespace RudderSdk.Unity
|
||||
{
|
||||
internal class UnityPlanScheduler : IPlanScheduler
|
||||
{
|
||||
public Task ScheduleAsync(TimeSpan delay, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return Task.Delay(delay, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4f8e4e8237be445c96672d96294c6c7
|
||||
@@ -1,30 +0,0 @@
|
||||
using RudderSdk.Core.Abstractions;
|
||||
|
||||
namespace RudderSdk.Unity
|
||||
{
|
||||
internal class UnityPlanStateStore : IPlanStateStore
|
||||
{
|
||||
private const string KEY = "liveops_plan_runner_state";
|
||||
|
||||
private readonly IUnityKeyValueStore _store;
|
||||
|
||||
public UnityPlanStateStore(IUnityKeyValueStore store)
|
||||
{
|
||||
_store = store;
|
||||
}
|
||||
|
||||
public string State
|
||||
{
|
||||
get => _store.GetString(KEY);
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
_store.DeleteKey(KEY);
|
||||
else
|
||||
_store.SetString(KEY, value);
|
||||
|
||||
_store.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 118ea3286be8b4daab53eaf7885507a0
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using RudderSdk.Core.Abstractions;
|
||||
|
||||
namespace RudderSdk.Unity
|
||||
{
|
||||
internal sealed class UnityRealtimeTransportFactory : IRealtimeTransportFactory
|
||||
{
|
||||
public IRealtimeTransport Create()
|
||||
{
|
||||
#if UNITY_WEBGL && !UNITY_EDITOR
|
||||
return new UnityRealtimeTransport(new JsWebSocketAdapter());
|
||||
#else
|
||||
return new UnityRealtimeTransport(new NativeWebSocketAdapter());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class UnityRealtimeTransport : IRealtimeTransport
|
||||
{
|
||||
private readonly IWebSocketAdapter _adapter;
|
||||
|
||||
public UnityRealtimeTransport(IWebSocketAdapter adapter)
|
||||
{
|
||||
_adapter = adapter;
|
||||
_adapter.Closed += () => Closed?.Invoke();
|
||||
_adapter.Received += data => Received?.Invoke(data);
|
||||
_adapter.ReceivedError += ex => Error?.Invoke(ex);
|
||||
}
|
||||
|
||||
public event Action Closed;
|
||||
public event Action<ArraySegment<byte>> Received;
|
||||
public event Action<Exception> Error;
|
||||
|
||||
public bool IsConnected => _adapter.IsConnected;
|
||||
|
||||
public Task ConnectAsync(Uri uri, TimeSpan timeout, CancellationToken cancellationToken = default)
|
||||
=> _adapter.ConnectAsync(uri, (int)Math.Ceiling(timeout.TotalSeconds), cancellationToken);
|
||||
|
||||
public Task SendAsync(ArraySegment<byte> data, CancellationToken cancellationToken = default)
|
||||
=> _adapter.SendAsync(data, cancellationToken);
|
||||
|
||||
public Task CloseAsync(CancellationToken cancellationToken = default)
|
||||
=> _adapter.CloseAsync();
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be75d4878806d40648e49338f0ecd508
|
||||
Reference in New Issue
Block a user