If you need to bind resize_data as the value in key/value, you will have to stringify it here.
Also, assuming here that socket is created on the main layout page. If its in a content page, you need to do content.resize.
Thank you so much for helping me Sid. I appreciate it.
Also can I know how can I use dmx.app.set properly if I want to access arrays in app connect. The tutorial on the docs weren't enough for me. And in general, are there good tutorials about dmx codes?
Thanks again
If you are trying to set some Wappler array named resize_data from JS, you can try this: dmx.app.data.resize_data.items = resize_data; resize_data on right is the JS array.
Additionally, Not sure why you are trying to push the resize_data to a Wappler array. For the user case of doing an emit, you can directly stringify and bind the JS resize_data object.. not need to push the items to Wappler array and then bind the Wappler array.
Yes, you are correct. No need here for creating a dmx array here. Except that I don't want to use JSON.stringify() a lot in my app because it's synchronous.
But now I want to use the response that's coming from the server to this socket emit. How to use it with the same dmx.parse() structure above?
I used to do the following with js:
socket.emit("resize", [
obj.getWidth(),
obj.getHeight(),
serializedObjects,
obj.viewportTransform
], (response) => {
console.log(response);
if (response && response.status === "ok") {
// do stuff here
}
}
)