LearnBoost/socket.io-client — Issue #366: Conflicts with JSON and other items if using prototype.js library
Author: crickeys
Created: 2012-01-09 07:17:19+00:00
State: open

I've noticed that if you have the prototype.js library installed on your page then the socket.io-client isn't going to work right. I've narrowed down a few of the issues to the fact that the prototype.js library override Array's toJSON function. And if your browser has nativeJSON then the browser is going to call that toJSON function which is going to mess up functions like stringify which socket.io-client uses heavily.

The final problem being that if I emit something to the server it ends up being malformed and, in my case, ends up sending an ARRAY instead of an OBJECT.

I'm not sure the best approach here. Perhaps relying on nativeJSON should be removed?