jadbalout / node-amf

AMF library for NodeJS
MIT License
2 stars 4 forks source link

Create an Externalized Object response on the server side #3

Closed cy-polo closed 1 year ago

cy-polo commented 2 years ago

Hello,

I would like to be able to reply to the client with a response containing an Externalized Object, but I can't.

Can you please tell me how to do it? I looked in the source code but I didn't understand. Thank you in advance for your answer!

What I want to do: image

What's happening right now: image

What I do:

class AMFAppSettingsService extends Service {
    constructor() {
        super("MovieStarPlanet.WebService.AppSettings.AMFAppSettingsService");
    }

    GetAppSettings(packet) {
        console.log(packet.bodies[0].data);

        // how node-amf can know it's a Externalized Object?

        packet.respond([ /* big array here */ ]);
    }
}

Thank you in advance for your help!

jadbalout commented 2 years ago

Hello! Sorry for the delayed response. Please update to the latest version 1.1.9 and see the example below:

const { TypedObjects } = require('@jadbalout/nodeamf');
const externalizedObject = new TypedObjects.ArrayCollection([ /* array here */]);
cy-polo commented 2 years ago

No problem, thanks for the answer! I'll try it soon.

Have a nice day!