English 中文(简体)
Socket hang in dnode
原标题:Socket hang in dnode

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).

服务器也一样。

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);

客户:

// Define client functions
dnode(function (remote, conn) {
    // Ping
    this.ping = function (cb) {
        cb("pong");
    };

    // Other functions
    ...
}).connect(server, port, { reconnect : 3000});
最佳回答

如你可以做以下工作:upnode,其中,缓冲器的指挥和再连接自动减少了dnodelinks。

我不认为<条码>连接<>。 预计会发射活动,因为你在isdnode s on connectionhandler.

您也不妨检查我的

问题回答

暂无回答




相关问题
How to make Sequelize use singular table names

I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.

What is Node.js? [closed]

I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...

Clientside going serverside with node.js

I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...

Can I use jQuery with Node.js?

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...

热门标签