{"id":13657990,"url":"https://github.com/sidorares/dbus-native","last_synced_at":"2025-04-05T06:08:20.342Z","repository":{"id":4303357,"uuid":"5435286","full_name":"sidorares/dbus-native","owner":"sidorares","description":"D-bus protocol client and server for node.js written in native javascript","archived":false,"fork":false,"pushed_at":"2024-07-28T12:07:23.000Z","size":1027,"stargazers_count":261,"open_issues_count":90,"forks_count":93,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-30T09:39:34.620Z","etag":null,"topics":["dbus"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidorares.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGE_LOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-08-16T05:37:06.000Z","updated_at":"2024-11-14T08:26:39.000Z","dependencies_parsed_at":"2024-11-13T10:04:23.296Z","dependency_job_id":"dacf0f69-7d02-4881-858d-0c8784494454","html_url":"https://github.com/sidorares/dbus-native","commit_stats":{"total_commits":345,"total_committers":47,"mean_commits":7.340425531914893,"dds":0.6434782608695653,"last_synced_commit":"acc02111b6351a46669e5856ec2ff7ad41107220"},"previous_names":["sidorares/node-dbus"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Fdbus-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Fdbus-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Fdbus-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Fdbus-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidorares","download_url":"https://codeload.github.com/sidorares/dbus-native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294539,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbus"],"created_at":"2024-08-02T05:00:54.868Z","updated_at":"2025-04-05T06:08:20.313Z","avatar_url":"https://github.com/sidorares.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"node-dbus\n===========\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/sidorares/dbus-native.svg)](https://greenkeeper.io/)\nD-bus protocol client and server for node.js\n\n[![Build Status](https://secure.travis-ci.org/sidorares/dbus-native.png)](http://travis-ci.org/sidorares/dbus-native)\n\nInstallation\n------------\n\n```shell\nnpm install dbus-native\n```\nor\n\n```shell\ngit clone https://github.com/sidorares/node-dbus # clone the repo\ncd node-dbus\nnpm install # install dependencies\nsudo cp examples/com.github.sidorares.dbus.Example.conf /etc/dbus-1/system.d/ # if you want to test examples/service.js\n```\n\nUsage\n------\n\nShort example using desktop notifications service\n\n```js\nvar dbus = require('dbus-native');\nvar sessionBus = dbus.sessionBus();\nsessionBus.getService('org.freedesktop.Notifications').getInterface(\n    '/org/freedesktop/Notifications',\n    'org.freedesktop.Notifications', function(err, notifications) {\n\n    // dbus signals are EventEmitter events\n    notifications.on('ActionInvoked', function() {\n        console.log('ActionInvoked', arguments);\n    });\n    notifications.on('NotificationClosed', function() {\n        console.log('NotificationClosed', arguments);\n    });\n    notifications.Notify('exampl', 0, '', 'summary 3', 'new message text', ['xxx yyy', 'test2', 'test3', 'test4'], [],  5, function(err, id) {\n       //setTimeout(function() { n.CloseNotification(id, console.log); }, 4000);\n    });\n});\n```\n\nAPI\n---\n\n### Low level messaging: bus connection\n\n`connection = dbus.createClient(options)`\n\noptions:\n   - socket - unix socket path\n   - port - TCP port\n   - host - TCP host\n   - busAddress - encoded bus address. Default is `DBUS_SESSION_BUS_ADDRESS` environment variable. See http://dbus.freedesktop.org/doc/dbus-specification.html#addresses\n   - authMethods - array of authentication methods, which are attempted in the order provided (default:['EXTERNAL', 'DBUS_COOKIE_SHA1', 'ANONYMOUS'])\n   - ayBuffer - boolean (default:true): if true 'ay' dbus fields are returned as buffers\n   - ReturnLongjs - boolean (default:false): if true 64 bit dbus fields (x/t) are read out as Long.js objects, otherwise they are converted to numbers (which should be good up to 53 bits)\n   - ( TODO: add/document option to use adress from X11 session )\n\nconnection has only one method, `message(msg)`\n\nmessage fields:\n   - type - methodCall, methodReturn, error or signal\n   - path - object path\n   - interface\n   - destination\n   - sender\n   - member\n   - serial\n   - signature\n   - body\n   - errorName\n   - replySerial\n\nconnection signals:\n   - connect - emitted after successful authentication\n   - message\n   - error\n\nexample:\n\n```js\nvar dbus = require('dbus-native');\nvar conn = dbus.createConnection();\nconn.message({\n    path:'/org/freedesktop/DBus',\n    destination: 'org.freedesktop.DBus',\n    'interface': 'org.freedesktop.DBus',\n    member: 'Hello',\n    type: dbus.messageType.methodCall\n});\nconn.on('message', function(msg) { console.log(msg); });\n```\n\n### Note on INT64 'x' and UINT64 't'\nLong.js is used for 64 Bit support. https://github.com/dcodeIO/long.js\nThe following javascript types can be marshalled into 64 bit dbus fields:\n   - typeof 'number' up to 53bits\n   - typeof 'string' (consisting of decimal digits with no separators or '0x' prefixed hexadecimal) up to full 64bit range\n   - Long.js objects (or object with compatible properties)\n\nBy default 64 bit dbus fields are unmarshalled into a 'number' (with precision loss beyond 53 bits). Use {ReturnLongjs:true} option to return the actual Long.js object and preserve the entire 64 bits.\n\n### Links\n   - http://cgit.freedesktop.org/dbus - freedesktop reference C library\n   - https://github.com/guelfey/go.dbus\n   - https://github.com/Shouqun/node-dbus - libdbus\n   - https://github.com/Motorola-Mobility/node-dbus - libdbus\n   - https://github.com/izaakschroeder/node-dbus - libdbus\n   - https://github.com/agnat/node_libdbus\n   - https://github.com/agnat/node_dbus - native js\n   - https://github.com/cocagne/txdbus - native python + twisted\n   - http://search.cpan.org/~danberr/Net-DBus-1.0.0/ (seems to be native, but requires libdbus?)\n   - https://github.com/mvidner/ruby-dbus (native, sync)\n   - http://www.ndesk.org/DBusSharp (C#/Mono)\n   - https://github.com/lizenn/erlang-dbus/ - erlang\n   - https://github.com/mspanc/dbux/ - elixir\n   - http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html - Blog post about sb-bus and D-Bus in general\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidorares%2Fdbus-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidorares%2Fdbus-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidorares%2Fdbus-native/lists"}