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

[bug] MsgPack support #227

Closed
MrImpossibru opened this issue Dec 6, 2019 · 0 comments
Closed

[bug] MsgPack support #227

MrImpossibru opened this issue Dec 6, 2019 · 0 comments
Labels

Comments

@MrImpossibru
Copy link

MrImpossibru commented Dec 6, 2019

Hi,
There is a bug with MsgPack support.
There is no data conversion in the Update_VM method in the DotNetifyLib.SignalR\DotNetifyHub.cs.

My solution:

      private object ConvertData(object data)
      {
        if (data == null)
          return null;
        else if (data is JsonElement)
          // System.Text.Json protocol.
          return JObject.Parse(((JsonElement)data).GetRawText());
        else if (data is JObject)
          // Newtonsoft.Json protocol.
          return data as JObject;
        else if (data.GetType().IsPrimitive || data is string)
          return data;
        else
          // MessagePack protocol.
          return JObject.FromObject(data);
      }
      public void Request_VM(string vmId, object vmArg)
      {
         var data = ConvertData(vmArg);

      ......
      public void Update_VM(string vmId, Dictionary<string, object> vmData)
      {
         try
         {
            _callerContext = Context;
            if (vmData != null)
            {
               var keys = vmData.Keys.ToArray();
               foreach (var key in keys)
               {
                  vmData[key] = ConvertData(vmData[key]);
               }
            }

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

No branches or pull requests

2 participants