dbusjs / node-dbus-next

🚌 The next great dbus library for node
https://www.npmjs.com/package/dbus-next
156 stars 52 forks source link

Add access to message in method handler #82

Open lesha1201 opened 3 years ago

lesha1201 commented 3 years ago

It would be nice to have an access to a message in method handler. Currently, we only have message body but sometimes you need to know, for example, who is sending the message (sender). It can be added without a breaking change by adding it as a last argument:

class ExampleInterface extends Interface {
    // ....

    @method({inSignature: 's', outSignature: 's'})
    Echo(what, message) {
        return what;
    }

    // Or it can be an object that contains any other additional info
    @method({inSignature: 's', outSignature: 's'})
    Echo(what, { message }) {
        return what;
    }
}
acrisci commented 3 years ago

Yeah I would accept this feature.