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