diff --git a/src/rpc.ts b/src/rpc.ts index 4e62b7a..9196ac3 100644 --- a/src/rpc.ts +++ b/src/rpc.ts @@ -244,7 +244,14 @@ export async function start() { jsonServer = new jayson.Server(rpcMethods, { useContext: true }); - (await getDHT("server")).on("connection", (socket: any) => { + (await getDHT("server")).on("connection", RPCConnection.handleRequest); +} + +class RPCConnection { + private _socket: any; + private _process = false; + constructor(socket: any) { + this._socket = socket; socket.rawStream._ondestroy = () => false; let isRpc = false;