davidfowl/Jabbot — pull request #7 by mikegeyser (2012-03-15 11:11:22+00:00)
Title: JSON Serialization Error

When attempting to naively connect to a Jabbr server (either fresh clone, or jabbr.net), an http 500 error is thrown. Investigating it on local, it appeared to be a problem in JSON deserialization. within Newtonsoft.Json library I would consistently get "Error parsing comment. Expected: *, got n. Line 1, position 1." or similar, depending on which command I was attempting to issue.

Looking at the Signalr.Client sources, it appears that the command (like "/help") was the only parameter being passed through to the _hub.Invoke arg array which in turn means that it was the only thing being populated into the json "data" element. When I investigated what is returned via the Jabbr client, there are additional elements sent in this JSON object - specifically "id" and "room". Assuming that the id was a generated message GUID, I sent a freshly generate Guid through as well, and it was successful.

I have wrapped the "command" argument in an anonymous type which includes a new Guid, but have ommitted the current room. It all works, but I'm not sure if some commands will fail to function because of this.

NB: If I have fundamentally misunderstood something, please let me know and I will correct it.