3
Node.js는 다른 많은 언어 에서처럼 IPC를 수행하는 표준 방법을 제공합니까? 나는 Node.js에 익숙하지 않고 발견 한 모든 정보는 child_process.fork() 또는 소켓 사용에 관한 것입니다.Node.js 프로세스 간 통신?
Node.js는 다른 많은 언어 에서처럼 IPC를 수행하는 표준 방법을 제공합니까? 나는 Node.js에 익숙하지 않고 발견 한 모든 정보는 child_process.fork() 또는 소켓 사용에 관한 것입니다.Node.js 프로세스 간 통신?
this 노드 패키지를 사용해 보셨습니까? 클라이언트에 대한
var ipc=require('node-ipc');
ipc.config.id = 'world';
ipc.config.retry= 1500;
ipc.serve(
function(){
ipc.server.on(
'message',
function(data,socket){
ipc.log('got a message : '.debug, data);
ipc.server.emit(
socket,
'message', //this can be anything you want so long as
//your client knows.
data+' world!'
);
}
);
}
);
ipc.server.start();
가능한 솔루션 : 자신의 문서, 가능한 예를 들어 서버의 수에 따라
var ipc=require('node-ipc');
ipc.config.id = 'hello';
ipc.config.retry= 1500;
ipc.connectTo(
'world',
function(){
ipc.of.world.on(
'connect',
function(){
ipc.log('## connected to world ##'.rainbow, ipc.config.delay);
ipc.of.world.emit(
'message', //any event or message type your server listens for
'hello'
)
}
);
ipc.of.world.on(
'disconnect',
function(){
ipc.log('disconnected from world'.notice);
}
);
ipc.of.world.on(
'message', //any event or message type your server listens for
function(data){
ipc.log('got a message from world : '.debug, data);
}
);
}
);
당신은 기본 IPC 말인가요? 또는 노드 프로세스 간의 통신? –
필자의 경우 프로세스 간 통신이 필요하지만 기본 IPC가 이상적입니다. – user3352528