Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts with JSON and other items if using prototype.js library #366

Closed
crickeys opened this issue Jan 9, 2012 · 2 comments
Closed

Conflicts with JSON and other items if using prototype.js library #366

crickeys opened this issue Jan 9, 2012 · 2 comments

Comments

@crickeys
Copy link
Contributor

crickeys commented Jan 9, 2012

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?

rauchg added a commit that referenced this issue Jan 17, 2012
#366 Do not rely on Array.prototype.indexOf
@farnoux
Copy link

farnoux commented Apr 15, 2013

Hi, any news on this? @crickeys, did you manage to work around this eventually?

@3rd-Eden
Copy link
Contributor

easiest solution would be using JSON3 instead of JSON2 which detects all these fuckups.

@rauchg rauchg closed this as completed Nov 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants