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

Allow for overriding JS json deserializing function #1564

Closed
stevozilik opened this issue Feb 21, 2013 · 2 comments
Closed

Allow for overriding JS json deserializing function #1564

stevozilik opened this issue Feb 21, 2013 · 2 comments
Assignees
Milestone

Comments

@stevozilik
Copy link

Currently signalr.js is hardcoded to use window.JSON.parse function for deserializing messages. The problem is that function is not capable of deserializing javascript dates i.e:

..."ServerTime":new Date(1361310055896)...

the $.connection object could expose a function that would be used for deserializing and by default use the window.JSON.parse, but allowing for overriding to any other deserializing func.

I guess same goes for serialization process, to be consistent.

@ghost ghost assigned DamianEdwards May 1, 2013
DamianEdwards added a commit that referenced this issue May 7, 2013
- Added connection.prototype.json which is initialized as window.JSON
- Changed default ajax content type to text
- Added connection._parseRespons helper to parse ajax responses from text to JSON (when it's not JSONP)
- Update all JS client code to use connection._parseResponse
- Added unit & functional tests
- Updated affected tests
- #1564
DamianEdwards added a commit that referenced this issue May 7, 2013
- Added connection.prototype.json which is initialized as window.JSON
- Changed default ajax content type to text
- Added connection._parseRespons helper to parse ajax responses from text to JSON (when it's not JSONP)
- Update all JS client code to use connection._parseResponse
- Added unit & functional tests
- Updated affected tests
- #1564
@ghost ghost assigned Xiaohongt May 7, 2013
@DamianEdwards
Copy link
Member

The JS client connection object now has a "json" property you can set to a custom object with parse and stringify methods. It defaults to window.JSON.

@Xiaohongt
Copy link
Contributor

verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants