sidorares/node-dbus — pull request #47 by gfxmonk (2014-11-05 11:02:50+00:00)
Title: Support for direct connections

PulseAudio uses a direct DBus connection - i.e there is no bus, you just connect to the pulseaudio daemon (unix socket) and talk DBus to it.

Notable differences between direct & regular connections are:

- direct connections don't use bus names, so there is no need to call Hello (in fact you _can't_, it's not implemented)
- you don't need to call addMatch / removeMatch to let the bus know you'd like to receive certain signals, any signals sent by the server will automatically be delivered

I figured most of this out from a similar change in the ruby-dbus library for the same reason:
https://github.com/mvidner/ruby-dbus/commit/76c9ade6f2fadaa17d86cc37798837b298fdddea

I also added a patch to implement removeListener, because some libraries (e.g StratifiedJS's builtin events library) expect the latter to be present for event emitters. Ideally it should work, but right now it prints a warning. I can drop that from the PR if there's an objection though.

My only concern is that it's not very clean to pass the same opts object through to both `createConnection()` and `new MessageBus()`, since their options could conflict in the future. It doesn't seem very likely though, perhaps we can just add code to detangle the single object if the need ever arises.