Make sending packet events possible
This commit is contained in:
parent
48a0713045
commit
8419ecdd09
@ -46,7 +46,7 @@ class CopyTransportS2 : Example.JRpcTransport {
|
||||
|
||||
public override Task Write(string data) {
|
||||
Console.WriteLine("--> " + data);
|
||||
this.tr1.DevSendPacket(data);
|
||||
this.tr1.SendPacketEvent(data);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@ -63,7 +63,7 @@ class CopyTransportS1 : Example.JRpcTransport {
|
||||
|
||||
public override Task Write(string data) {
|
||||
Console.WriteLine("<-- " + data);
|
||||
this.tr2.DevSendPacket(data);
|
||||
this.tr2.SendPacketEvent(data);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@ -77,8 +77,8 @@ class Program {
|
||||
var server = new Example.JRpcServer<int>();
|
||||
server.AddService(new TestSrvimpl());
|
||||
var transport = new CopyTransportS1();
|
||||
|
||||
var sess = server.GetSession(transport, 0);
|
||||
|
||||
var client = new Example.JRpcClient(transport.tr2);
|
||||
var testService = new Example.TestServiceClient(client);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hibas123/jrpcgen",
|
||||
"version": "1.0.16",
|
||||
"version": "1.0.18",
|
||||
"main": "lib/index.js",
|
||||
"license": "MIT",
|
||||
"packageManager": "yarn@3.1.1",
|
||||
|
@ -8,7 +8,8 @@ public abstract class JRpcTransport {
|
||||
public event NotifyPacket OnPacket;
|
||||
public abstract Task Write(string data);
|
||||
|
||||
public void DevSendPacket(string data) {
|
||||
// TODO: Spend some time finding a better permission, but it is fine for now
|
||||
public void SendPacketEvent(string data) {
|
||||
this.OnPacket.Invoke(data);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user