node-dbus
D-bus protocol client and server for node.js
Installation
Important: install socat
to be able to use session bus.
npm install dbus-native
or
git clone https://github.com/sidorares/node-dbus # clone the repo cd node-dbus npm install # install dependencies sudo cp examples/com.github.sidorares.dbus.Example.conf /etc/dbus-1/system.d/ # if you want to test examples/service.js
Usage
Short example using desktop notifications service
var dbus = ;var sessionBus = dbus;sessionBus;
API
Low level messaging: bus connection
connection = dbus.createClient(options)
options:
- socket - unix socket path
- port - TCP port
- host - TCP host
- busAddress - encoded bus address. Default is
DBUS_SESSION_BUS_ADDRESS
environment variable. See http://dbus.freedesktop.org/doc/dbus-specification.html#addresses - ( TODO: add/document option to use adress from X11 session )
connection has only one method, message(msg)
message fields:
- type - methodCall, methodReturn, error or signal
- path - object path
- interface
- destination
- sender
- member
- serial
- signature
- body
- errorName
- replySerial
connection signals:
- connect - emitted after successful authentication
- message
- error
example:
var dbus = ;var conn = dbus;conn;conn;