Update lib/dnode.js #111

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

akumpf commented Sep 12, 2012

It's very handy to know which connection ended/failed. Please pull in this simple update to enable callbacks with the object instance. thanks!

@akumpf akumpf Update lib/dnode.js
It's very handy to know which connection ended/failed. Please pull in this simple update to enable callbacks with the object instance.
a1bf1cb

akumpf commented Sep 14, 2012

any update on this? Should be a simple pull when you get a minute.

cheers,
Adam

akumpf commented Sep 27, 2012

bump. @substack any chance you could roll this in? There's a handful of pull requests as well, might be nice to do a quick update to keep dnode current.

I'm loving dnode and want to make sure it doesn't fade away :)

mitar commented Dec 9, 2012

+1

Owner

substack commented Dec 10, 2012

I don't understand why you would need this. If you're listening for events on the object then you already have the reference.

mitar commented Dec 10, 2012

Hm. I want to track all connections to all users. When a new remote event is triggered, I save it away. And when end event is triggered I would like to know which client disconnected so that I can clean up after the client.

substack closed this Feb 24, 2013

mitar commented Feb 24, 2013

Why is this closed? How do you get which connection was closed?

Owner

substack commented Feb 24, 2013

dnode instances are a single session so there is only one connection. I don't see how self.emit('error', err, self); could possibly fix whatever problem you are having since if you can listen for 'error' on self then you already have the reference to self. This pull request doesn't make any sense.

substack reopened this Feb 24, 2013

substack closed this Feb 24, 2013

mitar commented Feb 24, 2013

The point is, that we have:

d.on('remote', function (remote) {

And here we are proposing, that you could have:

d.on('end', function (remote) {

So, how do you know for which remote the end event is without passing self in?

Why I need this? I want to keep list of all remotes so that I can broadcast to all when I need. So I want to add to the list on remote event and remove from the list on end event. But how do I know what to remove on end event? Where can I learn which remote connection ended?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment