PHP Classes

File: examples/nodejs-ipc-server/src/server.js

Recommend this page to a friend!
  Classes of Juraj Puchký  >  PHP Node.js Communication IPC Client  >  examples/nodejs-ipc-server/src/server.js  >  Download  
File: examples/nodejs-ipc-server/src/server.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Node.js Communication IPC Client
Send messages to a Node server via sockets
Author: By
Last change:
Date: 2 years ago
Size: 426 bytes
 

Contents

Class file image Download
/**
* @author Juraj Puchký - BABA Tumise s.r.o.
* @description IPC server sample
*/

const ipc = require('node-ipc');

const ipcSocketPath = '/tmp/sample.sock';

// IPC handler

ipc.serve(
    ipcSocketPath,
    function() {
        ipc.server.on(
            'message',
            function(data,socket) {
                console.log(`pid ${process.pid} got: `, data);
            }
        );
    }
);

ipc.server.start();
For more information send a message to info at phpclasses dot org.