Skip to content

NSSocket server loses requests when responses are sent by child process. #50

@StTod

Description

@StTod

Server code:
var worker = child_process.fork('child.js');
var server = nssocket.createServer(function(socket) {
socket.data('data', function (data) {
worker.send(data.toString('utf8'), socket.socket, {keepOpen: true});
});
});

child.js
process.on('message', function(data, socket) {
send(socket, 'data', data);
});

function send(socket, event, data, callback) {
var delimiter = '::';
if (typeof event === 'string') {
event = event.split(delimiter);
}
var message = Buffer(JSON.stringify(event.concat(data)) + '\n');

socket.write(message, callback);
};

The client send 10 requests and after timeout from 1000 milliseconds send another 10 request and so on.
The first 10 request have their responses, but next lost responses.

I use nssocker v0.6.0, Node.js v6.9.4 and testing on Windows 10 with NetBeans IDE 8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions