h-sifat / express-ipc

A simple IPC server with express-like request and route handling that also supports broadcasting to multiple channels.
MIT License
7 stars 0 forks source link

Client IPC inside of method of the Class object #3

Closed jhay06 closed 2 months ago

jhay06 commented 2 months ago

I dont know why ? but per observation , i cannot connect to server when the client instantiation happens inside of the class method and call it later when needed for example

class MyClient{ async callExpress(){ const client = new Client({ path: socketPath }); console.log(JSON.stringify(client)) try { const response = await client.post("/network/login", { username: "admin", password: "admin" }); console.log(response); } catch (ex) { console.log(ex); }

client.close(); } }

then will call the callexpress when a certain button event clicked , but it does not connect ,

EDIT: i can connect from class when starting the app.js and immediately call the class and method , but it does not connect when the app.js already up and then call the class with the method when the button clicks ,

jhay06 commented 2 months ago

okay i think there's an issue when there is 2 pipe and only 1 client is conneting to 2 pipes .