-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(scripting/v8): expose msgpack codec globally for custom type sup… #2931
base: master
Are you sure you want to change the base?
Conversation
…port - Added `global.msgpack_codec` to provide access to the msgpack codec. - Enables developers to easily add custom serializers/deserializers. - Maintains backward compatibility with existing msgpack_pack/unpack functions.
Here is a link to my documentation pull request: citizenfx/fivem-docs#503 |
Personally I'd like to see a modern and more efficient msgpack implemented before we get access to the codec. The current one hasn't been touched for 8 years and is lacking a lot of JS features. https://github.com/kawanet/msgpack-lite @AvarianKnight might also have some thoughts on this. |
There's a lot better encoders/decoders for msgpack now and it would make a lot of sense to swap to them (see msgpackr for one that's really fast, and blows out all current implementations) |
Thank you for the suggestion! (I don't know if this message is directed to the right place.) Here’s what I’ve managed so far and the issues I’ve encountered:
Note: I have not made any test with C#. These challenges would require additional development to resolve and could impact other parts of the project. I’d love to hear your thoughts or suggestions on addressing these issues. Additionally, if you'd like, I can share the code I’ve worked on so far to help provide more context. Please let me know where and how I should share it. |
Goal of this PR
Expose the msgpack codec globally to enable developers to easily add custom serializers and deserializers, enhancing flexibility for handling custom types in FiveM scripts.
How is this PR achieving the goal
This PR adds a new global variable, global.msgpack_codec, which provides direct access to the existing msgpack codec. Developers can use this to register custom types via addExtPacker and addExtUnpacker while maintaining backward compatibility with the current global.msgpack_pack and global.msgpack_unpack functions.
This PR applies to the following area(s)
Successfully tested on
Game builds:: 3258
Platforms: Windows
Checklist
Fixes issues
No specific issues reported for this feature addition.