substack/dnode — Issue #91: Help me understand why requests are queueing in browser like upnode.
Author: danielmahon
Created: 2012-02-18 01:37:33+00:00
State: open

When I disconnect the server, the browser clients still try to connect and any calls to the server functions are queued and eventually come through when I restart the server. I just want to know why... not complaining. I thought that was a feature of upnode only.

## server.js
```
dnode(DnodeServer).use(upnode.ping).listen(app);

var clients = {},
totalTaps = 0;

function DnodeServer(client, conn) {
//connect clients
conn.on('ready', function() {
clients[conn.id] = client;
console.log(conn.id+' connected.');
console.log(clients);
});
conn.on('end', function() {
delete clients[conn.id];
console.log(conn.id+' disconnected.')
});
this.total = function(cb) { cb(totalTaps)};
this.tap = function(n, res) {
totalTaps = totalTaps+n;
for (var key in clients) {
clients[key].update(totalTaps);
}
console.log('Taps: '+totalTaps);
};
}
```
## client.js