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

Signalr DateTime Request/Response disparity #46

Closed
alangley opened this issue Oct 25, 2011 · 4 comments
Closed

Signalr DateTime Request/Response disparity #46

alangley opened this issue Oct 25, 2011 · 4 comments

Comments

@alangley
Copy link

I am using WCF data services to 'query' for data models from my web application, but then I use SignalR to receive 'push' updates.

WCF Data Services (OData) formats dates as a string in the format "/Date(1319493384779)/". This is fine, because I then generate client-side (javascript) viewmodels where I create actual Javascript Date() objects. SignalR also sends DateTime objects from the server to the client as "/Date(1319493384779)/", but it appears to expect an actual Date() object when passing from javascript to a server hub method via Javascript - using the above date format causes a format exception in the JSON deserializer. This is rather inefficient, because I already have a model object in javascript, and I should just be able to send it to a SignalR hub as-is.

Does anybody have any idea why this is happening?

(SO: http://stackoverflow.com/questions/7882535/signalr-datetime-request-response-disparity)

@davidfowl
Copy link
Member

Not sure what you mean? Are you saying things are double serialized? We serialize outgoing messages using the JavascriptSerializer in System.Web.Extensions by default (you can replace this).

@alangley
Copy link
Author

Hi David,

Sorry, I have continued the discussion on the Stack Overflow thread.

To elaborate, sending the same object received be server push, back to the hub causes a serialization failure.
So, it seems the server deserialization is different from the server serialization... But I've demonstrated this more clearly on SO

Thanks

Sent from my iPhone

On 26/10/2011, at 4:15 PM, David Fowlerreply@reply.github.com wrote:

Not sure what you mean? Are you saying things are double serialized? We serialize outgoing messages using the JavascriptSerializer in System.Web.Extensions by default (you can replace this).

Reply to this email directly or view it on GitHub:
#46 (comment)

@davidfowl
Copy link
Member

I've reproed this. Thanks for filing it

@davidfowl
Copy link
Member

This seems to be a limitation of the JavascriptSerializer we're using. The date format isn't roundtrippable.

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

2 participants