Giter Club home page Giter Club logo

Comments (8)

magne4000 avatar magne4000 commented on August 14, 2024

This should work as intended, options just overrides any default value:

Object.assign(ipc.config, options);

Could you share the config that you are using? I would test it to see if I can get the same behaviour.

from stream-json-rpc.

fas3r avatar fas3r commented on August 14, 2024

Hello @magne4000 ,

Thanks for your feedback, indeed it should, I did something like that for the server :

  const ipcServer = getServer('my-namespace', {
      requestCert: false,
      rejectUnauthorized:false,
      interface: {
        localAddress: '127.0.0.1',
        localPort: 8888,
        family: 4
      }
  });

I guess it should be enough.

Btw great repos

from stream-json-rpc.

fas3r avatar fas3r commented on August 14, 2024

Hello @magne4000 ,

Did you have a chance to try by any chance ?

thanks

from stream-json-rpc.

magne4000 avatar magne4000 commented on August 14, 2024

I just saw you had a typo, it's interfaces: not interface:. Nevertheless, I only created helpers for UNIX sockets (ipc.connect() and ipc.server()) and not net sockets (ipc.connectNet() and ipc.serveNet()).
You can easily implement your own helpers by copying and modifying the following functions in your own code

export const getClient = (appspace: string, id: string = 'client', options: object = {}): Client => {
const ipc = new nodeipc.IPC();
ipc.config.appspace = appspace;
ipc.config.id = id;
ipc.config.silent = true;
ipc.config.retry = 1000;
ipc.config.rawBuffer = true;
ipc.config.encoding = 'hex';
Object.assign(ipc.config, options);
ipc.connectTo('server', () => {});
return ipc.of.server;
};
export const getServer = (appspace: string, options: object = {}): Server => {
const ipc = new nodeipc.IPC();
ipc.config.appspace = appspace;
ipc.config.id = 'server';
ipc.config.silent = true;
ipc.config.retry = 1000;
ipc.config.rawBuffer = true;
ipc.config.encoding = 'hex';
Object.assign(ipc.config, options);
ipc.serve(() => {});
ipc.server.start();
return ipc.server;
};

from stream-json-rpc.

fas3r avatar fas3r commented on August 14, 2024

Hello @magne4000 ,

Yes sorry, I tought I updated the comment regarding the typo.

Yes I will do so, I just wanted to avoid modifications as you might make changes in the futures.

Feel free to close the ticket,

Thanks

from stream-json-rpc.

fas3r avatar fas3r commented on August 14, 2024

Hello @magne4000 ,

Do you think it's something that you could implement ? Or maybe are you open to PR for that ?

Thanks

from stream-json-rpc.

magne4000 avatar magne4000 commented on August 14, 2024

I'm open to PR for that ! 👍

from stream-json-rpc.

fas3r avatar fas3r commented on August 14, 2024

@magne4000 you are amazing, thank you very much

from stream-json-rpc.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.