mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 21:21:03 +00:00
Update MessageReceiver.cs, app.js #132
This commit is contained in:
parent
c8b3ac5d99
commit
f181bf2696
|
@ -3,6 +3,7 @@
|
||||||
using DeviceId;
|
using DeviceId;
|
||||||
using Grpc.Core;
|
using Grpc.Core;
|
||||||
using Grpc.Net.Client;
|
using Grpc.Net.Client;
|
||||||
|
using System;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WelsonJS.GrpcService;
|
using WelsonJS.GrpcService;
|
||||||
|
@ -33,8 +34,9 @@ namespace WelsonJS.Service
|
||||||
// Set the GRPC channel
|
// Set the GRPC channel
|
||||||
channel = GrpcChannel.ForAddress(grpcServerAddress);
|
channel = GrpcChannel.ForAddress(grpcServerAddress);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
this.parent.Log(ex.Message);
|
||||||
channel = null;
|
channel = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +69,9 @@ namespace WelsonJS.Service
|
||||||
{
|
{
|
||||||
var response = call.ResponseStream.Current;
|
var response = call.ResponseStream.Current;
|
||||||
parent.Log($"Received: {response.Message}");
|
parent.Log($"Received: {response.Message}");
|
||||||
|
|
||||||
|
// dispatch to the script runtime
|
||||||
|
parent.DispatchServiceEvent("messageReceived", new string[] { response.Message });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
1
app.js
1
app.js
|
@ -621,6 +621,7 @@ function dispatchServiceEvent(name, eventType, _args) {
|
||||||
start: bind("ServiceStart"),
|
start: bind("ServiceStart"),
|
||||||
stop: bind("ServiceStop"),
|
stop: bind("ServiceStop"),
|
||||||
elapsedTime: bind("ServiceElapsedTime"),
|
elapsedTime: bind("ServiceElapsedTime"),
|
||||||
|
messageReceived: bind("MessageReceived"),
|
||||||
screenTime: bind("ServiceScreenTime"),
|
screenTime: bind("ServiceScreenTime"),
|
||||||
fileCreated: bind("FileCreated"),
|
fileCreated: bind("FileCreated"),
|
||||||
fileRuleMatched: bind("FileRuleMatched")
|
fileRuleMatched: bind("FileRuleMatched")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user