mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-09-13 20:43:19 +00:00
Working
This commit is contained in:
@@ -159,8 +159,8 @@ public partial class MyService
|
|||||||
[Export]
|
[Export]
|
||||||
public void InvokeEvents(string msg, InvocationContext context)
|
public void InvokeEvents(string msg, InvocationContext context)
|
||||||
{
|
{
|
||||||
if (context.Connection.Session.AuthorizedAccount != "Alice")
|
//if (context.Connection.Session.AuthorizedAccount != "Alice")
|
||||||
throw new Exception("Only Alice is allowed.");
|
// throw new Exception("Only Alice is allowed.");
|
||||||
|
|
||||||
StringEvent?.Invoke(msg);
|
StringEvent?.Invoke(msg);
|
||||||
ArrayEvent?.Invoke(new object[] { DateTime.UtcNow, "Event", msg });
|
ArrayEvent?.Invoke(new object[] { DateTime.UtcNow, "Event", msg });
|
||||||
|
@@ -200,8 +200,7 @@ namespace Test
|
|||||||
private static async void TestClient(IResource local)
|
private static async void TestClient(IResource local)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var con = await new Warehouse().Get<DistributedConnection>("iip://localhost", new DistributedConnectionConfig
|
||||||
var con = await Warehouse.Default.Get<DistributedConnection>("iip://localhost", new DistributedConnectionConfig
|
|
||||||
{
|
{
|
||||||
AutoReconnect = true,
|
AutoReconnect = true,
|
||||||
Username = "admin",
|
Username = "admin",
|
||||||
@@ -210,8 +209,11 @@ namespace Test
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dynamic remote = await con.Get("sys/service");
|
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 pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow);
|
||||||
|
|
||||||
var temp = await con.Call("temp");
|
var temp = await con.Call("temp");
|
||||||
@@ -259,7 +261,7 @@ namespace Test
|
|||||||
|
|
||||||
//Console.WriteLine(path);
|
//Console.WriteLine(path);
|
||||||
|
|
||||||
perodicTimer = new Timer(new TimerCallback(perodicTimerElapsed), remote, 0, 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async void perodicTimerElapsed(object state)
|
static async void perodicTimerElapsed(object state)
|
||||||
@@ -268,6 +270,8 @@ namespace Test
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dynamic remote = state;
|
dynamic remote = state;
|
||||||
|
await remote.InvokeEvents("Hello");
|
||||||
|
|
||||||
Console.WriteLine("Perodic : " + await remote.AsyncHello());
|
Console.WriteLine("Perodic : " + await remote.AsyncHello());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Reference in New Issue
Block a user