Merge pull request #12 from RIAEvangelist/brandon
issue #11 and logging objects
This commit is contained in:
commit
86b241eb36
5 changed files with 28 additions and 3 deletions
|
@ -15,7 +15,7 @@ ipc.serve(
|
|||
ipc.server.on(
|
||||
'app.message',
|
||||
function(data,socket){
|
||||
ipc.log('got a message from'.debug, (data.id).variable, (data.message).data);
|
||||
//ipc.log('got a message from'.debug, (data.id).variable, (data.message).data);
|
||||
ipc.server.emit(
|
||||
socket,
|
||||
'app.message',
|
||||
|
|
|
@ -115,6 +115,18 @@ function connect(){
|
|||
'data',
|
||||
function(data) {
|
||||
client.log('## recieved events ##'.rainbow);
|
||||
if(!this.ipcBuffer)
|
||||
this.ipcBuffer='';
|
||||
|
||||
data=(this.ipcBuffer+=data);
|
||||
|
||||
if(data.slice(-1)!=eventParser.delimiter){
|
||||
client.log('Socket buffer size exceeded consider smaller messages or a larger buffer.'.warn, 'Implementing software buffer expansion for this message.'.notice);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ipcBuffer='';
|
||||
|
||||
var events = eventParser.parse(data);
|
||||
var eCount = events.length;
|
||||
for(var i=0; i<eCount; i++){
|
||||
|
|
|
@ -166,6 +166,18 @@ function init(path,config,log,port){
|
|||
socket.on(
|
||||
'data',
|
||||
function(data,UDPSocket){
|
||||
if(!this.ipcBuffer)
|
||||
this.ipcBuffer='';
|
||||
|
||||
data=(this.ipcBuffer+=data);
|
||||
|
||||
if(data.slice(-1)!=eventParser.delimiter){
|
||||
server.log('Socket buffer size exceeded, consider smaller messages or a larger buffer.'.warn, 'Implementing software buffer expansion for this message.'.notice);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ipcBuffer='';
|
||||
|
||||
data=eventParser.parse(data);
|
||||
var sock=((server.udp4 || server.udp6)? UDPSocket : socket);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var os = require('os'),
|
||||
util = require('util'),
|
||||
colors = require('colors'),
|
||||
pubsub = require('event-pubsub'),
|
||||
eventParser = require('./lib/eventParser.js'),
|
||||
|
@ -52,7 +53,7 @@ function log(){
|
|||
if(typeof args[i] != 'object')
|
||||
continue;
|
||||
|
||||
args[i]=JSON.stringify(args[i]);
|
||||
args[i]=util.inspect(args[i],{colors:true});
|
||||
}
|
||||
|
||||
console.log(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-ipc",
|
||||
"version": "0.9.13",
|
||||
"version": "0.9.15",
|
||||
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",
|
||||
"main": "node-ipc.js",
|
||||
"directories": {
|
||||
|
|
Loading…
Reference in a new issue