Gio.DBusConnection.prototype.send_message_with_reply
function send_message_with_reply(message: Gio.DBusMessage, flags: Gio.DBusSendMessageFlags, timeout_msec: Number(gint), cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback): Number(guint32) { // Gjs wrapper for g_dbus_connection_send_message_with_reply() }
Asynchronously sends message to the peer represented by connection.
Unless flags contain the Gio.DBusSendMessageFlags.preserve_serial flag, the serial number will be assigned by connection and set on message via Gio.DBusMessage.prototype.set_serial. If @out_serial is not null, then the serial number used will be written to this location prior to submitting the message to the underlying transport.
If connection is closed then the operation will fail with Gio.IOErrorEnum.closed. If cancellable is canceled, the operation will fail with Gio.IOErrorEnum.cancelled. If message is not well-formed, the operation fails with Gio.IOErrorEnum.invalid_argument.
This is an asynchronous method. When the operation is finished, callback will be invoked in the [thread-default main context][g-main-context-push-thread-default] of the thread you are calling this method from. You can then call Gio.DBusConnection.prototype.send_message_with_reply_finish to get the result of the operation. See Gio.DBusConnection.prototype.send_message_with_reply_sync for the synchronous version.
Note that message must be unlocked, unless flags contain the Gio.DBusSendMessageFlags.preserve_serial flag.
See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Since 2.26
- message
- flags
flags affecting how the message is sent
- timeout_msec
the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
- cancellable
a Gio.Cancellable or null
- callback
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result
- Returns
return location for serial number assigned to message when sending it or null