On Mon, Dec 24, 2012 at 03:10:52AM -0800, Nir Rozen wrote: > Hi all, > > I'm quite new to node.js and wanted to ask what is the correct data type to > store TCP sockets? looking at Ryan Dahl's video I could see he used array > to store sockets, I would like to know what do you think about it... > > I mean when store 50K sockets, is it efficient to use array?
It depends on what you want to do with them: If you're broadcasting, and you just want to round-robin distribute packets to all of them, that's perfectly reasonable. If you need to attach handlers to each, variables in closures are probably more natural.
pgpzN6FBPMhO1.pgp
Description: PGP signature
