Hacker News new | past | comments | ask | show | jobs | submit login

Using .apply({}, arguments) is actually a bit slower, but either method is so fast that it won't be a bottleneck. I use it in this case for elegance, because I can. Note that in your original implementation this is impossible, because you have to access the "type" variable and use one of two methods (sendUTF or sendBytes). `ws` has only one method (send) and the parameters of this method match the arguments to the callback for on('message').



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: