Gio.DBusConnection.prototype.send_message

function send_message(message: Gio.DBusMessage, flags: Gio.DBusSendMessageFlags): [ok: Boolean, out_serial: Number(guint32)] {
    // Gjs wrapper for g_dbus_connection_send_message()
}
  

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 message is not well-formed, the operation fails with Gio.IOErrorEnum.invalid_argument.

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.

Note that message must be unlocked, unless flags contain the Gio.DBusSendMessageFlags.preserve_serial flag.

Since 2.26

message

a Gio.DBusMessage

flags

flags affecting how the message is sent

ok

true if the message was well-formed and queued for transmission, false if @error is set

out_serial

return location for serial number assigned to message when sending it or null