Basic examples corrections

With the basic examples verbatim, the server was throwing the following error

```
.../sandbox/node_modules/node-ipc/lib/socketServer.js:34
    socket.write(
           ^
TypeError: undefined is not a function
...
```

Adding the missing `socket` reference on line 536 corrected this problem.

There was also an error in the `require` statement.
This commit is contained in:
Rob McGuire-Dale 2015-04-24 15:20:14 -07:00
parent 7625b22395
commit c23fa0a430

View file

@ -353,6 +353,7 @@ The server is the process keeping a socket for IPC open. Multiple sockets can co
function(data,socket){ function(data,socket){
ipc.log('got a message : '.debug, data); ipc.log('got a message : '.debug, data);
ipc.server.emit( ipc.server.emit(
socket,
'message', 'message',
data+' world!' data+' world!'
); );
@ -366,7 +367,7 @@ The server is the process keeping a socket for IPC open. Multiple sockets can co
#### Client for Unix Sockets & TCP Sockets #### Client for Unix Sockets & TCP Sockets
The client connects to the servers socket for Inter Process Communication. The socket will recieve events emitted to it specifically as well as events which are broadcast out on the socket by the server. This is the most basic example which will work for both local Unix Sockets and local or remote network TCP Sockets. The client connects to the servers socket for Inter Process Communication. The socket will recieve events emitted to it specifically as well as events which are broadcast out on the socket by the server. This is the most basic example which will work for both local Unix Sockets and local or remote network TCP Sockets.
var ipc=require('../../../node-ipc'); var ipc=require('node-ipc');
ipc.config.id = 'hello'; ipc.config.id = 'hello';
ipc.config.retry= 1500; ipc.config.retry= 1500;