node-dbus-next icon indicating copy to clipboard operation
node-dbus-next copied to clipboard

Add access to message in method handler

Open lesha1201 opened this issue 4 years ago • 1 comments

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;
    }
}

lesha1201 avatar Aug 24 '21 14:08 lesha1201

Yeah I would accept this feature.

acrisci avatar Sep 20 '21 00:09 acrisci