diff --git a/DBus-service.md b/DBus-service.md index 1f118d5..c931217 100644 --- a/DBus-service.md +++ b/DBus-service.md @@ -37,3 +37,25 @@ To avoid the startup time of the JVM for the dbus client, you can use any dbus c Example with `dbus-send`: dbus-send --session --type=method_call --print-reply --dest="org.asamk.Signal" /org/asamk/Signal org.asamk.Signal.sendMessage string:MessageText array:string: string:RECIPIENT + + +### Receive messages from signal-cli daemon +The signal-cli daemon publishes new messages to dbus. +Here's an example using python: + +```python3 +def msgRcv (timestamp, source, groupID, message, attachments): + print ("Message", message, "received in group", signal.getGroupName (groupID)) + return + +from pydbus import SystemBus +from gi.repository import GLib + +bus = SystemBus() +loop = GLib.MainLoop() + +signal = bus.get('org.asamk.Signal') + +signal.onMessageReceived = msgRcv +loop.run() +``` \ No newline at end of file