SignalR/SignalR — pull request #1555 by davidfowl (2013-02-20 11:32:16+00:00)
Title: Made changes to core types to support binary (output is still JSON)

Overall this change should improve memory allocations for websocket sends and overall allocations for the message values in general. We now encode on the way in (once) and write bytes directly to the output stream or websocket.

- Change the underlying storage in the MessageBus to ArraySegment
- Changed IJsonSerializer.Deserialize to take a TextReader instead of a string
- Write directly to the websocket in chunks instead of allocating tons of strings using the ResponseWriter (it was adapter to support IWebSocket).
- When writing out the persistent response as json, write the message chunk as Binary if the underlying writer implements IBinaryWriter.
- Fallback to old behavior if TextWriter isn't IBinaryWriter.

TODO:
- Add support for passing ArraySegment, byte[] and JRaw at the connection level.
- Change new scaleout providers (in scaleout branch) to serialize the payload with the new ArraySegment structure.