freedomjs / freedom

Embracing a distributed web
http://freedomjs.org
Apache License 2.0
515 stars 53 forks source link

TCP listen interface should return the address & port listened on. #55

Open iislucas opened 10 years ago

iislucas commented 10 years ago

See: https://github.com/freedomjs/freedom/blob/master/interface/core.js#L105

I suspect listen should probably be giving back the address and port that end up being listened on.

trevj commented 10 years ago

Yes, I think that would be preferable to having to call getInfo() to query the host and port. Ditto for the UDP provider.

willscott commented 10 years ago

Worth thinking about why we would favor this as opposed to the separate calls exposed by chrome, node, and unix sockets.

trevj commented 10 years ago

Good point...I think we would need to keep the getInfo() calls in any case.

iislucas commented 10 years ago

node, chrome and unix don't use the nice notion of async by promises, if they did, it would be natural to have listen asynchronously return the IP/PORT. Since we live in a better world, we can eat cake and use promises. :)

On Fri, Jun 6, 2014 at 2:17 PM, trevj notifications@github.com wrote:

Good point...I think we would need to keep the getInfo() calls in any case.

— Reply to this email directly or view it on GitHub https://github.com/freedomjs/freedom/issues/55#issuecomment-45368237.

Lucas Dixon | Google Ideas

willscott commented 10 years ago

node and chrome already return from the listen() callback asynchronously with callbacks about when the operation has completed. Promises should be no different?

iislucas commented 10 years ago

I think we're talking cross-purposes... lets chat on Tuesday when I have time. :)

On Wed, Jul 9, 2014 at 7:56 PM, Will notifications@github.com wrote:

node and chrome already return from the listen() callback asynchronously with callbacks about when the operation has completed. Promises should be no different?

— Reply to this email directly or view it on GitHub https://github.com/freedomjs/freedom/issues/55#issuecomment-48550346.

Lucas Dixon | Google Ideas

agallant commented 9 years ago

So I believe this hasn't happened (i.e. current use requires calling listen() and getInfo() separately). Is this still something we want to consider?