I have developed a client/server bi-directional communication using dnode.
When a client connects to the server, I keep the connection so the server can use this connection to invoke a method on the client when it needs to.
Sometimes the connection seems to become inactive, I then need to restart the client manually. Could the connection remain active with some specific options ? (I though the reconnect every 3s would do the trick but does not seem to be the case).
The server is like
dnode(function (remote, conn) {
conn.on('connect', function (){ // THIS METHOD IS NEVER CALLED !!! I DON'T KNOW WHY
console.log("connection");
});
// Connection starts
conn.on('ready', function () {
// Keep remote in a hash for later usage
...
});
// Connection ends
conn.on('end', function(){
// Remove remote object from hash
...
});
}).listen(5000);
The client:
// Define client functions
dnode(function (remote, conn) {
// Ping
this.ping = function (cb) {
cb("pong");
};
// Other functions
...
}).connect(server, port, {'reconnect': 3000});