Git Product home page Git Product logo

Comments (6)

ygoe avatar ygoe commented on May 20, 2024

Can you please also log the content of data and its type (typeof(data))? This doesn't look like a byte array which it's supposed to be.

from msgpack.js.

anuraj avatar anuraj commented on May 20, 2024

It is a complex object. But I tried with simple string, that also not working.

[HttpGet("{id}")]
public ActionResult<string> Get(int id)
{
    return "value";
}

Here is the response header.

image

from msgpack.js.

ygoe avatar ygoe commented on May 20, 2024

The thing is, the deserializeMsgPack function expects a byte array to be passed in. A byte array consists only of bytes. A byte is an integer value in the range of 0 to 255. All of these values are handled in the code. If something else occurs, then it's not a byte array. And chances are that it needs further conversion to be deserialisable.

I'll have to create a sample project and try out myself what's happening there. I can't make any more assumptions without investigating live code.

Here's code from where I use this library. It processes data received from a WebSocket client.

function onMessage(event) {
    let array = new Uint8Array(event.data);
    let obj = deserialize(array);
}

event.data is already a binary array and is then converted into a Uint8Array. Maybe you need to do something similar.

from msgpack.js.

anuraj avatar anuraj commented on May 20, 2024

Okay. Let me try.

from msgpack.js.

ygoe avatar ygoe commented on May 20, 2024

Any news here? I can't create a demo project because the type MessagePackOutputFormatter cannot be found anywhere. Can you maybe provide a minimal test case for this? I only know about ASP.NET Core 2.1, you seem to use 2.2. Maybe I'll have to wait a bit to run your example.

from msgpack.js.

anuraj avatar anuraj commented on May 20, 2024

Oops, my bad. I am able to resolve it. Full details here - https://dotnetthoughts.net/using-message-pack-with-asp-net-core/. Thank you for your response 👍

from msgpack.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.