Gio.DBusConnection.prototype.close
function close(cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback): void { // Gjs wrapper for g_dbus_connection_close() }
Closes connection. Note that this never causes the process to exit (this might only happen if the other end of a shared message bus connection disconnects, see Gio.DBusConnection.exit_on_close).
Once the connection is closed, operations such as sending a message will return with the error Gio.IOErrorEnum.closed. Closing a connection will not automatically flush the connection so queued messages may be lost. Use Gio.DBusConnection.prototype.flush if you need such guarantees.
If connection is already closed, this method fails with Gio.IOErrorEnum.closed.
When connection has been closed, the Gio.DBusConnection.closed signal is emitted in the [thread-default main context][g-main-context-push-thread-default] of the thread that connection was constructed in.
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.close_finish to get the result of the operation. See Gio.DBusConnection.prototype.close_sync for the synchronous version.
Since 2.26
- 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