From 8f1a29b44ea1129486dd135624ab08f7d4c74a0b Mon Sep 17 00:00:00 2001 From: ahmed Date: Tue, 26 Aug 2025 06:18:15 +0300 Subject: [PATCH] Working --- Test/MyService.cs | 4 ++-- Test/Program.cs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Test/MyService.cs b/Test/MyService.cs index 0df3d03..3cfd41f 100644 --- a/Test/MyService.cs +++ b/Test/MyService.cs @@ -159,8 +159,8 @@ public partial class MyService [Export] public void InvokeEvents(string msg, InvocationContext context) { - if (context.Connection.Session.AuthorizedAccount != "Alice") - throw new Exception("Only Alice is allowed."); + //if (context.Connection.Session.AuthorizedAccount != "Alice") + // throw new Exception("Only Alice is allowed."); StringEvent?.Invoke(msg); ArrayEvent?.Invoke(new object[] { DateTime.UtcNow, "Event", msg }); diff --git a/Test/Program.cs b/Test/Program.cs index 544ac0f..065edd8 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -200,8 +200,7 @@ namespace Test private static async void TestClient(IResource local) { - - var con = await Warehouse.Default.Get("iip://localhost", new DistributedConnectionConfig + var con = await new Warehouse().Get("iip://localhost", new DistributedConnectionConfig { AutoReconnect = true, Username = "admin", @@ -210,8 +209,11 @@ namespace Test }); + dynamic remote = await con.Get("sys/service"); + perodicTimer = new Timer(new TimerCallback(perodicTimerElapsed), remote, 0, 1000); + var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow); var temp = await con.Call("temp"); @@ -259,7 +261,7 @@ namespace Test //Console.WriteLine(path); - perodicTimer = new Timer(new TimerCallback(perodicTimerElapsed), remote, 0, 1000); + } static async void perodicTimerElapsed(object state) @@ -268,6 +270,8 @@ namespace Test try { dynamic remote = state; + await remote.InvokeEvents("Hello"); + Console.WriteLine("Perodic : " + await remote.AsyncHello()); } catch (Exception ex)