It would be nice to expose server-side dbus objects to the client. Not just notifications as done in #22. So client-side applications could interact with server-side applications through the link we already have.
Based on dbus-python examples - which we should be able to forward easily enough:
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=690 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
method call sender=:1.413 -> dest=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello signal sender=org.freedesktop.DBus -> dest=(null destination) serial=691 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged string "com.example.SampleService"
call-service"?) and return only once we get the result ("
service-return"?) - probably re-using the nested mainloop code since the bindings will share the same main loop
For clients that do not have dbus support (OSX, win32 or posix clients without a dbus session running), we can still provide ways of interacting with the remote dbus session:
For services we cannot introspect... nothing for now.
Since there is nothing that requires us to be tied to dbus, we should ensure that other RPC tools can be plugged in without too much effort - (whilst still targetting dbus as the main RPC implementation)
The first problem is that although dbus defines an introspection interface, the output is in XML (PITA!). And we don't want to know about the interface we export in advance. Yuk, even dbus-inspector is parsing XML...
Another, bigger problem is that dbus calls expect to return immediately, and will block the main loop until we do return... which will never return if we deadlock trying to use the network from the mainloop (more info here). Using the nested main loop code is off-putting, and would not work on osx. Using our own dedicated dbus thread for the main loop could work, but would not play well with any other dbus calls we could end up making... (ie: notifications)
Also, I can't see how we would dynamically add the methods we found through introspection to an object we register. The service method are normally registered using annotations..
Finally, the gtk all-in-one we use on win32 does not include dbus... Although equivalent for windows.
example dbus service which can be used for testing
example client for the example service
As of r4759, we can call server-side dbus services and get the reply asynchronously:
Noneare recognized as arguments)
The number of arguments to the service's function is variable and optional. You can specify as many or as few as you like, and the type of the arguments will be preserved over the wire.
Attached is an example dbus service (and an example client - just for completeness, not used), start it from within an xpra session which has a dbus server, then you can interact with it from the client end:
client.dbus_call('org.xpra.Test', '/org/xpra/Test', 'org.xpra.Test', 'Notify', None, None, 'themessage')
xpra attach :10 "--key-shortcut=Meta+Shift+F7:dbus_call('org.xpra.Test', \ '/org/xpra/Test', 'org.xpra.Test', 'Notify', None, None, 'hello')"
Then you just trigger the dbus call using the key combination.
To enable the dbus server-side debugging, set:
XPRA_DBUS_DEBUG=1 xpra start ...
Probably complete enough for a first round of feedback.
It took some hand-holding from Smo to get the python dbus-listener.py in place on the server, but once that was done the
Notify message came through clear as... day.
If you need me to run the debugger to get some output (because I'm sure you need the reading) let me know, but since it seemed to work exactly as hoped with a fedora 19 client and server, I suspect that won't be necessary.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/450