Skip to content

ProxyObject or Interface went away event missing #103

Open
@KryQ

Description

@KryQ

Hi
The problem I'm facing is checking if service emitting signals went dark. There seems to not be any event emitted when interface goes down. To make problem worse when service goes back up properties.on("SendBrightness", ()=>{}); does not work anymore.

What I'm doing to circumvent this problem is registering listener on brightness service as usual:

const registerBrightnessService = async () => {
	try {
		// get a proxy object
		const obj = await bus.getProxyObject("me.kryq.brightness", "/me/kryq/brightness");
		const properties = obj.getInterface("me.kryq.brightness");

		properties.on("SendBrightness", ()=>{});
	}
	catch (e) {
		console.log(e.toString());

		setTimeout(registerBrightnessService, 5000);
	}
};

but then listening on the bus for messages:

bus.on("message", (msg:dbus.Message)=> {
		if(msg.interface == "me.kryq.brightness" && msg.member === "SendBrightness") {
			setBrightness(msg.body[0])
				.catch(console.error);
		}
	});

This allows me to listen to messages when service reconnects.

Is there any event I'm missing?
Thanks for help

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @KryQ

      Issue actions

        ProxyObject or Interface went away event missing · Issue #103 · dbusjs/node-dbus-next