-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
Currently MsgPack.Deserialize eventually invokes Stream.Read which is blocking. It would be great if there is an asynchronous version BeginDeserialize<T>/EndDeserialize<T> that takes advantage of Stream.BeginRead / Stream.EndRead, so to make the operation asynchronous.
This is good enough for Unity3D (.NET 3.5). For higher version of the runtime (e.g. the experimental .NET 4.6), of course the TAP APIs can be added over the foundational Begin/End async API.
Currently to avoid blocking, I have to create a MemoryStream, asynchronously read (BeginRead/EndRead) from the NetworkStream, and copy the data into the MemoryStream object, and invoke MsgPack.Deserialize on the MemoryStream to make the operation fully asynchronous.