Jump to content

Recommended Posts

Posted (edited)

There is an issue with the current way the data transfer is handled between different realms (server/client/cef). If I pass a JS object (such as a Date, or my own object) from server to client and vice versa, everything works as expected, however when passing the same object/array/etc from client into CEF, rage serializes, resulting in a string being passed into cef (when expected an array/object).
For example:

// client
browser.call('test', [1, 2, 3]);

// browser

mp.events.add('test', (arr) => {
    typeof arr; // string
    console.log(arr); // '[1,2,3]'
});


This is very unintuitive and makes little sense. I understand that it's easier to make a workaround like this but it is not documented anywhere, and creates a print-debugging time sink.

Now, the goal of this post is not to properly document it, but improve this system to actually be able to pass objects into CEF, like you can do between the server and the client.

Edited by flowxrc
  • Like 1
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...