Giter Club home page Giter Club logo

Comments (4)

or-else avatar or-else commented on May 16, 2024 1

so the type need to be registered

Yes, but not all types, just the interface types.

json.RawMessage basically is []byte isn’t it? So if it is saved on database it will be saved as binary, right?

Yes, it is and yes it will be saved as binary.

OK, let's keep this fix for now. We can revisit it if new problems appear.

from chat.

or-else avatar or-else commented on May 16, 2024

I'll check it out today.

from chat.

or-else avatar or-else commented on May 16, 2024

Hi Riandy,
I made a quick fix and pushed it to devel 25ac06e.

That's not the recommended way though. A correct fix would be to replace all interface{} types in https://github.com/tinode/chat/blob/master/server/datamodel.go with a concrete type like json.RawMessage. Unfortunately it will likely affect the data already stored in the database. If you are OK with that I'll try the RawMessage fix.

from chat.

riandyrn avatar riandyrn commented on May 16, 2024

I made a quick fix and pushed it to devel 25ac06e.

Hoo…, I see, so the type need to be registered before the creation of ClusterNode. Previously I was also tried to use gob.Register() but instead put it on clusterInit(), I put it on (n *ClusterNode) call(), so it always return following error: [gob: name not registered for interface: "[]interface {}”]. Haha…

with a concrete type like json.RawMessage

Hmm…, json.RawMessage basically is []byte isn’t it? So if it is saved on database it will be saved as binary, right?

If so, I personally think it’s better to go with current fix, because it is much easier to debug + easier to integrate with another system.

from chat.

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.