I guess the important question to ask is: do you really need it in a first
place? Is it possible to wrap the net.Socket into some other object on your
application level, and set the properties on it instead?

On Monday, March 23, 2015, Aria Stewart <[email protected]> wrote:

> On Monday, March 23, 2015 at 11:20:12 PM UTC-4, Zhongcai Ng wrote:
>>
>> Am tagging custom properties on NodeJS socket objects. ie, socket.id,
>> socket.someCustomProperty, etc.
>>
>> Like to ask if there's any prohibition imposed on custom property names.
>> Am scared that I will break something unintentionally. With current and
>> future versions of NodeJS
>>
> That's tough. It's a wide open namespace, and predicting the future is
> impossible.
>
> If you can use ES6 features, consider not putting the property on the
> object, but instead using a WeakMap, and keeping your own stuff separate:
>
>     var wm = new WeakMap();
>     wm.set(socket, { yourproperty: value });
>
>     wm.get(socket).yourproperty
>
> If not, namespace hard. Perhaps socket.yourmodulename.yourproperty?
> socket['yourmodulename:yourproperty']?
>
> Aria
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <javascript:_e(%7B%7D,'cvml','nodejs%[email protected]');>.
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/9958558a-a4ea-4344-a498-90fe801db4d6%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/9958558a-a4ea-4344-a498-90fe801db4d6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAEv2VfKagmenpTTYnbAxbqgfDpGFrNp2d52%2B%3D8A_69sR0%3DRtbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to