*Refactor RPC connection to its own class

This commit is contained in:
Derrick Hammer 2022-07-22 20:58:32 -04:00
parent a9f5b4d2c8
commit ea4a993182
1 changed files with 8 additions and 1 deletions

View File

@ -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;